Skip to content

Commit ab8be1a

Browse files
committed
fixed factorize bug
1 parent 7d4d62e commit ab8be1a

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

openml/datasets/dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ def _parse_data_from_arff( # noqa: C901, PLR0912, PLR0915
488488
try:
489489
# checks if the strings which should be the class labels
490490
# can be encoded into integers
491-
pd.factorize(type_)[0]
491+
pd.factorize(np.array(type_))[0]
492492
except ValueError as e:
493493
raise ValueError(
494494
"Categorical data needs to be numeric when using sparse ARFF."

tests/test_datasets/test_dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ def setUp(self):
357357
def test_get_sparse_dataset_dataframe_with_target(self):
358358
X, y, _, attribute_names = self.sparse_dataset.get_data(target="class")
359359
assert isinstance(X, pd.DataFrame)
360-
assert isinstance(X.dtypes[0], pd.SparseDtype)
360+
assert isinstance(X.dtypes.iloc[0], pd.SparseDtype)
361361
assert X.shape == (600, 20000)
362362

363363
assert isinstance(y, pd.Series)

0 commit comments

Comments
 (0)