8000 adding test case test_permutation_test_score_pandas() to check if per… · scikit-learn/scikit-learn@9ea5c9e · GitHub
[go: up one dir, main page]

Skip to content

Commit 9ea5c9e

Browse files
Stijn TonkStijn Tonk
Stijn Tonk
authored and
Stijn Tonk
committed
adding test case test_permutation_test_score_pandas() to check if permutation_test_score plays nice with pandas dataframe/series
1 parent 3cf5e8f commit 9ea5c9e

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

sklearn/model_selection/tests/test_validation.py

+16
Original file line numberDiff line numberDiff line change
@@ -966,3 +966,19 @@ def test_score_memmap():
966966
break
967967
except WindowsError:
968968
sleep(1.)
969+
970+
def test_permutation_test_score_pandas():
971+
# check permutation_test_score doesn't destroy pandas dataframe
972+
types = [(MockDataFrame, MockDataFrame)]
973+
try:
974+
from pandas import Series, DataFrame
975+
types.append((Series, DataFrame))
976+
except ImportError:
977+
pass
978+
for TargetType, InputFeatureType in types:
979+
# X dataframe, y series
980+
X_df, y_ser = InputFeatureType(X), TargetType(y)
981+
check_df = lambda x: isinstance(x, InputFeatureType)
982+
check_series = lambda x: isinstance(x, TargetType)
983+
clf = CheckingClassifier(c 3BF1 heck_X=check_df, check_y=check_series)
984+
permutation_test_score(clf, X_df, y_ser)

0 commit comments

Comments
 (0)
0