@@ -65,7 +65,7 @@ def columnwise_metric(
65
65
f"({ df1 .columns } != { df2 .columns } )"
66
66
)
67
67
if type_cols == "all" :
68
- cols = df1 .columns
68
+ cols = df1 .columns . tolist ()
69
69
elif type_cols == "numerical" :
70
70
cols = utils ._get_numerical_features (df1 )
71
71
elif type_cols == "categorical" :
@@ -74,6 +74,8 @@ def columnwise_metric(
74
74
raise ValueError (
75
75
f"Value { type_cols } is not valid for parameter `type_cols`!"
76
76
)
77
+ if cols == []:
78
+ raise ValueError (f"No column found for the type { type_cols } !" )
77
79
values = {}
78
80
for col in cols :
79
81
df1_col = df1 .loc [df_mask [col ], col ]
@@ -510,6 +512,8 @@ def mean_difference_correlation_matrix_numerical_features(
510
512
_check_same_number_columns (df1 , df2 )
511
513
512
514
cols_numerical = utils ._get_numerical_features (df1 )
515
+ if cols_numerical == []:
516
+ raise Exception ("No numerical feature found" )
513
517
df_corr1 = _get_correlation_pearson_matrix (
514
518
df1 [cols_numerical ], use_p_value = use_p_value
515
519
)
@@ -594,6 +598,8 @@ def mean_difference_correlation_matrix_categorical_features(
594
598
_check_same_number_columns (df1 , df2 )
595
599
596
600
cols_categorical = utils ._get_categorical_features (df1 )
601
+ if cols_categorical == []:
602
+ raise Exception ("No categorical feature found" )
597
603
df_corr1 = _get_correlation_chi2_matrix (
598
604
df1 [cols_categorical ], use_p_value = use_p_value
599
605
)
@@ -681,7 +687,11 @@ def mean_diff_corr_matrix_categorical_vs_numerical_features(
681
687
_check_same_number_columns (df1 , df2 )
682
688
683
689
cols_categorical = utils ._get_categorical_features (df1 )
690
+ if cols_categorical == []:
691
+ raise Exception ("No categorical feature found" )
684
692
cols_numerical = utils ._get_numerical_features (df1 )
693
+ if cols_numerical == []:
694
+ raise Exception ("No numerical feature found" )
685
695
df_corr1 = _get_correlation_f_oneway_matrix (
686
696
df1 , cols_categorical , cols_numerical , use_p_value = use_p_value
687
697
)
0 commit comments