From 24a6f4aae0f12425fb6f1f09f64bd610ace383b9 Mon Sep 17 00:00:00 2001 From: Richard Neher Date: Fri, 18 Oct 2019 22:08:57 +0200 Subject: [PATCH] wrappers: explicitly case discrete states to unicode to avoid str~float comparison when pandas parses missing data as np.nan --- treetime/wrappers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/treetime/wrappers.py b/treetime/wrappers.py index b70a90a0..a2052ae0 100644 --- a/treetime/wrappers.py +++ b/treetime/wrappers.py @@ -754,7 +754,7 @@ def mugration(params): attr = states.columns[1] print("Attribute for mugration inference was not specified. Using "+attr, file=sys.stderr) - leaf_to_attr = {x[taxon_name]:x[attr] for xi, x in states.iterrows() + leaf_to_attr = {x[taxon_name]:str(x[attr]) for xi, x in states.iterrows() if x[attr]!=params.missing_data} mug, letter_to_state, reverse_alphabet = reconstruct_discrete_traits(params.tree, leaf_to_attr, missing_data=params.missing_data,