Skip to content

Commit 1622876

Browse files
committed
HOTFIX-20201211: discretization
- discretization might not work properly in certain cases when it has a type of object rather than float
1 parent cab4ded commit 1622876

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

FIDDLE/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def smart_qcut_dummify(x, bin_edges, use_ordinal_encoding=False):
159159
out.loc[m, col_names[i]] = (z.loc[m] >= bin_edge).astype(int)
160160
out = pd.concat([out, pd.get_dummies(z.where(~m, np.nan), prefix=z.name)], axis=1)
161161
else:
162-
z.loc[m] = pd.cut(z.loc[m].to_numpy(), bin_edges, duplicates='drop', include_lowest=True)
162+
z.loc[m] = pd.cut(z.loc[m].astype(float).to_numpy(), bin_edges, duplicates='drop', include_lowest=True)
163163
out = pd.get_dummies(z, prefix=z.name)
164164
else:
165165
out = pd.get_dummies(x, prefix=x.name)

0 commit comments

Comments
 (0)