Skip to content

Commit

Permalink
Merge pull request #189 from evidentlyai/small_fix_in_dq_features_widget
Browse files Browse the repository at this point in the history
Bug fix
  • Loading branch information
emeli-dral committed Mar 23, 2022
2 parents fc83047 + 478b4ea commit ed2558c
Showing 1 changed file with 3 additions and 3 deletions.
Expand Up @@ -669,10 +669,10 @@ def _transform_cat_features(
cat_feature_names = cat_feature_names + [target_column]
for feature_name in cat_feature_names:
if reference_data[feature_name].nunique() > 6:
cats = reference_data[feature_name].value_counts()[:5].index.astype(str)
reference_data[feature_name] = reference_data[feature_name].apply(lambda x: x if x in cats else "other")
cats = reference_data[feature_name].value_counts().iloc[:5].index.astype(str)
reference_data[feature_name] = reference_data[feature_name].apply(lambda x: x if str(x) in cats else "other")
if current_data is not None:
current_data[feature_name] = current_data[feature_name].apply(lambda x: x if x in cats else "other")
current_data[feature_name] = current_data[feature_name].apply(lambda x: x if str(x) in cats else "other")

def _choose_agg_period(
self, date_column: str, reference_data: pd.DataFrame, current_data: Optional[pd.DataFrame]
Expand Down

0 comments on commit ed2558c

Please sign in to comment.