def test_features_data(data_classification_balanced, feature_descriptor, expected_raw_mapping): """Testing if .data() returns mapped df (with replaced values according to mapping) but without Target column ( when drop_target=True). """ X, y = data_classification_balanced f = Features(X, y, feature_descriptor) expected_df = X.drop(["Date"], axis=1).replace(expected_raw_mapping) cols = expected_df.columns actual_df = f.data(drop_target=True)[cols] assert actual_df.equals(expected_df)
def test_features_data_excluded_transformed( data_classification_balanced, feature_descriptor, transformed_columns, expected_raw_mapping ): """Testing if data returns correctly mapped dataframe without transformed columns when excluded_transformed is set to True.""" X, y = data_classification_balanced f = Features(X, y, feature_descriptor, transformed_columns) expected_df = X.drop(["Date"], axis=1) if transformed_columns: expected_df = expected_df.drop(transformed_columns, axis=1) expected_df = expected_df.replace(expected_raw_mapping) cols = expected_df.columns actual_df = f.data(exclude_transformed=True)[cols] assert actual_df.equals(expected_df)