Skip to content

Commit

Permalink
Merge pull request #151 from welch-b/1-dataframe_to_matrix_bug
Browse files Browse the repository at this point in the history
There is a bug on line 109 of original file due to deprecated Pandas …
  • Loading branch information
brifordwylie authored Jan 16, 2024
2 parents 36685ae + 266613b commit 1ebcf4e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion zat/dataframe_to_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def fit_category_nans(df):
"""ONLY FIT: Convert np.NaNs to a category 'NaN'"""
for column in df.select_dtypes(include=['category']).columns:
if df[column].isnull().any():
df[column].cat.add_categories('NaN', inplace=True)
df[column] = df[column].cat.add_categories('NaN')
df[column].fillna('NaN', inplace=True)

@staticmethod
Expand Down

0 comments on commit 1ebcf4e

Please sign in to comment.