From d1d96b00026c699794f4d596eb2ed68d5e425b93 Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 24 Jun 2024 11:46:14 -0400 Subject: [PATCH] fix for #1527 this includes the fixes described in the issue --- src/ydata_profiling/model/pandas/correlations_pandas.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ydata_profiling/model/pandas/correlations_pandas.py b/src/ydata_profiling/model/pandas/correlations_pandas.py index 8dae428f0..42ee0b141 100644 --- a/src/ydata_profiling/model/pandas/correlations_pandas.py +++ b/src/ydata_profiling/model/pandas/correlations_pandas.py @@ -26,21 +26,21 @@ def pandas_spearman_compute( config: Settings, df: pd.DataFrame, summary: dict ) -> Optional[pd.DataFrame]: - return df.corr(method="spearman") + return df.corr(method="spearman", numeric_only=True) @Pearson.compute.register(Settings, pd.DataFrame, dict) def pandas_pearson_compute( config: Settings, df: pd.DataFrame, summary: dict ) -> Optional[pd.DataFrame]: - return df.corr(method="pearson") + return df.corr(method="pearson", numeric_only=True) @Kendall.compute.register(Settings, pd.DataFrame, dict) def pandas_kendall_compute( config: Settings, df: pd.DataFrame, summary: dict ) -> Optional[pd.DataFrame]: - return df.corr(method="kendall") + return df.corr(method="kendall", numeric_only=True) def _cramers_corrected_stat(confusion_matrix: pd.DataFrame, correction: bool) -> float: @@ -195,7 +195,7 @@ def pandas_auto_compute( method = ( _pairwise_spearman - if col_1_name and col_2_name not in categorical_columns + if col_1_name not in categorical_columns and col_2_name not in categorical_columns else _pairwise_cramers )