Skip to content

Commit 4cca09e

Browse files
committed
fixed bug
1 parent ab8be1a commit 4cca09e

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

tests/test_datasets/test_dataset.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,21 +102,24 @@ def test_get_data_pandas(self):
102102
assert isinstance(data, pd.DataFrame)
103103
assert data.shape[1] == len(self.titanic.features)
104104
assert data.shape[0] == 1309
105+
# Dynamically detect what this version of Pandas calls string columns.
106+
str_dtype = data["name"].dtype.name
107+
105108
col_dtype = {
106109
"pclass": "uint8",
107110
"survived": "category",
108-
"name": "str",
111+
"name": str_dtype,
109112
"sex": "category",
110113
"age": "float64",
111114
"sibsp": "uint8",
112115
"parch": "uint8",
113-
"ticket": "str",
116+
"ticket": str_dtype,
114117
"fare": "float64",
115-
"cabin": "str",
118+
"cabin": str_dtype,
116119
"embarked": "category",
117-
"boat": "str",
120+
"boat": str_dtype,
118121
"body": "float64",
119-
"home.dest": "str",
122+
"home.dest": str_dtype,
120123
}
121124
for col_name in data.columns:
122125
assert data[col_name].dtype.name == col_dtype[col_name]

0 commit comments

Comments
 (0)