From a4ea88eaa9bd0f9f00a845ca62d500513bc42ecd Mon Sep 17 00:00:00 2001 From: Alex Barros Date: Thu, 20 Oct 2022 06:02:56 -0300 Subject: [PATCH] fix: correlation `auto` passing extra parameters (#1114) * fix: correlation `auto` passing extra parameters * fix: Remove debugger trace Co-authored-by: Alexandre Quemy --- src/pandas_profiling/model/correlations.py | 2 +- src/pandas_profiling/model/pandas/correlations_pandas.py | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/pandas_profiling/model/correlations.py b/src/pandas_profiling/model/correlations.py index 580cd1807..7698e85e6 100644 --- a/src/pandas_profiling/model/correlations.py +++ b/src/pandas_profiling/model/correlations.py @@ -25,7 +25,7 @@ class Auto(Correlation): @staticmethod @multimethod def compute( - config: Settings, df: Sized, summary: dict, n_bins: int + config: Settings, df: Sized, summary: dict ) -> Optional[Sized]: raise NotImplementedError() diff --git a/src/pandas_profiling/model/pandas/correlations_pandas.py b/src/pandas_profiling/model/pandas/correlations_pandas.py index e96a771e4..b88581b27 100644 --- a/src/pandas_profiling/model/pandas/correlations_pandas.py +++ b/src/pandas_profiling/model/pandas/correlations_pandas.py @@ -156,12 +156,11 @@ def pandas_phik_compute( return correlation -@Auto.compute.register(Settings, pd.DataFrame, dict, int) +@Auto.compute.register(Settings, pd.DataFrame, dict) def pandas_auto_compute( config: Settings, df: pd.DataFrame, - summary: dict, - n_bins: int = 10, + summary: dict ) -> Optional[pd.DataFrame]: threshold = config.categorical_maximum_correlation_distinct @@ -175,7 +174,7 @@ def pandas_auto_compute( and value["n_distinct"] <= threshold ] df_discretized = Discretizer( - DiscretizationType.UNIFORM, n_bins=n_bins + DiscretizationType.UNIFORM, n_bins=config.correlations["auto"].n_bins ).discretize_dataframe(df) columns_tested = numerical_columns + categorical_columns correlation_matrix = pd.DataFrame(