Skip to content

Commit

Permalink
fix for ydataai#1527
Browse files Browse the repository at this point in the history
this includes the fixes described in the issue
  • Loading branch information
mdering authored and fabclmnt committed Jul 8, 2024
1 parent be3ec22 commit ca6acec
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/ydata_profiling/model/pandas/correlations_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
)

Expand Down

0 comments on commit ca6acec

Please sign in to comment.