feature-engine / feature_engine

Feature engineering package with sklearn like functionality
https://feature-engine.trainindata.com/
BSD 3-Clause "New" or "Revised" License
1.8k stars 303 forks source link

Unit tests not passing #659

Closed ClaudioSalvatoreArcidiacono closed 1 year ago

ClaudioSalvatoreArcidiacono commented 1 year ago

Describe the bug Unit tests from the main branch are failing.

To Reproduce

git clone https://github.com/feature-engine/feature_engine.git
cd feature_engine
pip install -e .
pip install -r test_requirements.txt
pytest

Expected behavior Tests should pass

Screenshots

FAILED tests/test_datetime/test_datetime_features.py::test_extract_datetime_features_with_default_options - AssertionError: Attributes of DataFrame.iloc[:, 2] (column name="datetime_range_month") are different
FAILED tests/test_datetime/test_datetime_features.py::test_extract_datetime_features_from_specified_variables - AssertionError: Attributes of DataFrame.iloc[:, 5] (column name="date_obj1_month") are different
FAILED tests/test_datetime/test_datetime_features.py::test_extract_all_datetime_features - AssertionError: Attributes of DataFrame.iloc[:, 2] (column name="datetime_range_month") are different
FAILED tests/test_datetime/test_datetime_features.py::test_extract_specified_datetime_features - AssertionError: Attributes of DataFrame.iloc[:, 2] (column name="datetime_range_hour") are different
FAILED tests/test_datetime/test_datetime_features.py::test_extract_features_from_categorical_variable - AssertionError: Attributes of DataFrame.iloc[:, 0] (column name="date_obj1_month") are different
FAILED tests/test_datetime/test_datetime_features.py::test_extract_features_from_different_timezones - AssertionError: Attributes of DataFrame.iloc[:, 0] (column name="time_obj_hour") are different
FAILED tests/test_datetime/test_datetime_features.py::test_extract_features_from_localized_tz_variables - AssertionError: Attributes of DataFrame.iloc[:, 0] (column name="date_var_hour") are different
FAILED tests/test_datetime/test_datetime_features.py::test_extract_features_without_dropping_original_variables - AssertionError: Attributes of DataFrame.iloc[:, 7] (column name="datetime_range_quarter") are different
FAILED tests/test_datetime/test_datetime_features.py::test_extract_features_with_different_datetime_parsing_options - AssertionError: Attributes of DataFrame.iloc[:, 0] (column name="date_obj2_day_of_month") are different
FAILED tests/test_datetime/test_datetime_subtraction.py::test_subtraction_units[M-expected1] - AssertionError: DataFrame.iloc[:, 2] (column name="date1_sub_date2") are different
FAILED tests/test_encoding/test_count_frequency_encoder.py::test_error_when_df_contains_unseen_categories - UserWarning: Could not infer format, so each element will be parsed individually, falling back to `dateutil`. To ensure parsing is consistent and as-expected, please specify a format.
FAILED tests/test_encoding/test_count_frequency_encoder.py::test_no_error_triggered_when_df_contains_unseen_categories_and_unseen_is_encode - UserWarning: Could not infer format, so each element will be parsed individually, falling back to `dateutil`. To ensure parsing is consistent and as-expected, please specify a format.
FAILED tests/test_encoding/test_mean_encoder.py::test_warning_if_transform_df_contains_categories_not_present_in_fit_df - assert 3 == 1
FAILED tests/test_encoding/test_ordinal_encoder.py::test_error_if_input_df_contains_categories_not_present_in_training_df - assert 3 == 1
FAILED tests/test_encoding/test_woe/test_woe_encoder.py::test_warn_if_transform_df_contains_categories_not_seen_in_fit - assert 3 == 1
FAILED tests/test_imputation/test_drop_missing_data.py::test_return_na_data_method - TypeError: NDFrame._add_numeric_operations.<locals>.any() takes 1 positional argument but 2 were given
FAILED tests/test_time_series/test_forecasting/test_window_features.py::test_multiple_windows - pandas.errors.MergeError: Not allowed to merge between different levels. (1 levels on the left, 2 on the right)
FAILED tests/test_transformation/test_reciprocal_transformer.py::test_automatically_find_variables - AssertionError: Attributes of DataFrame.iloc[:, 2] (column name="Age") are different

Desktop (please complete the following information):

Additional context N/A

ClaudioSalvatoreArcidiacono commented 1 year ago

It looks like this is due to the release of pandas 2.0 on April 3rd

solegalli commented 1 year ago

Yes, I am always dancing at the pace of pandas and sklearn releases lol!

Thanks for raising the issue.