Skip to content

Commit

Permalink
Fix for crash in rare cases of comparing specific mix of ints and floats
Browse files Browse the repository at this point in the history
  • Loading branch information
fbdesignpro committed Jul 18, 2020
1 parent 57376f0 commit 7720a19
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion sweetviz/series_analyzer_numeric.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,16 @@ def do_detail_numeric(series: pd.Series, counts: dict, counts_compare: dict, upd
def get_comparison_num(feature_name):
this_comparison = None
if this_compare_count is not None:
this_comparison = this_compare_count.get(feature_name)
try:
this_comparison = this_compare_count.get(feature_name)
except TypeError:
# Workaround for cases where source dataset has ints only, but compare has floats...
pass
#...this was incorrect as it could have created false matches:
# if this_compare_count.index.dtype.name.find('int') != -1:
# this_comparison = this_compare_count.get(np.int64(feature_name))
# else:
# this_comparison = None
if this_comparison is not None:
this_comparison = NumWithPercent(this_comparison, compare_total_num)
else:
Expand Down

0 comments on commit 7720a19

Please sign in to comment.