diff --git a/setup.py b/setup.py index d4765cf648e..ae99e1dbec8 100644 --- a/setup.py +++ b/setup.py @@ -188,7 +188,7 @@ TESTS_REQUIRE.extend(VISION_REQUIRE) TESTS_REQUIRE.extend(AUDIO_REQUIRE) -QUALITY_REQUIRE = ["ruff>=0.3.0,<0.5.0"] +QUALITY_REQUIRE = ["ruff>=0.3.0"] DOCS_REQUIRE = [ # Might need to add doc-builder and some specific deps in the future diff --git a/src/datasets/features/features.py b/src/datasets/features/features.py index 0973a1fed28..df8eeffd306 100644 --- a/src/datasets/features/features.py +++ b/src/datasets/features/features.py @@ -841,7 +841,7 @@ def __array__(self, dtype=None): https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.api.extensions.ExtensionArray.html#pandas.api.extensions.ExtensionArray """ - if dtype == object: + if dtype == np.dtype(object): out = np.empty(len(self._data), dtype=object) for i in range(len(self._data)): out[i] = self._data[i] diff --git a/tests/features/test_array_xd.py b/tests/features/test_array_xd.py index 61a0fd7650e..8a50823b996 100644 --- a/tests/features/test_array_xd.py +++ b/tests/features/test_array_xd.py @@ -362,7 +362,7 @@ def test_table_to_pandas(dtype, dummy_value): features = datasets.Features({"foo": datasets.Array2D(dtype=dtype, shape=(2, 2))}) dataset = datasets.Dataset.from_dict({"foo": [[[dummy_value] * 2] * 2]}, features=features) df = dataset._data.to_pandas() - assert type(df.foo.dtype) == PandasArrayExtensionDtype + assert isinstance(df.foo.dtype, PandasArrayExtensionDtype) arr = df.foo.to_numpy() np.testing.assert_equal(arr, np.array([[[dummy_value] * 2] * 2], dtype=np.dtype(dtype)))