NOAA-OWP / hydrotools

Suite of tools for retrieving USGS NWIS observations and evaluating National Water Model (NWM) data.
Other
54 stars 13 forks source link

contingency_table computed from compute_contingency_table doesn’t contain both True and False for the observed or the simulated series #183

Closed xfeng2021 closed 2 years ago

xfeng2021 commented 2 years ago

The following line in function compute_contingency_table:

ctab = pd.crosstab(observed, simulated, dropna=False) produces ctab containing only True or False for either the observed or the simulated series? It would cause the error in ctab.loc.

Could you add a solution to handle such situation?

jarq6c commented 2 years ago

Verified if either of the input categorical series contain only True or False, then compute_contingency_table fails with a KeyError for the missing boolean category.