Skip to content

ENH/TST: ArrowExtenstionArray.reshape raises NotImplementedError #47302

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pandas/core/arrays/arrow/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,12 @@ def factorize(self, na_sentinel: int = -1) -> tuple[np.ndarray, ExtensionArray]:

return indices.values, uniques

def reshape(self, *args, **kwargs):
raise NotImplementedError(
f"{type(self)} does not support reshape "
f"as backed by a 1D pyarrow.ChunkedArray."
)

def take(
self,
indices: TakeIndexer,
Expand Down
22 changes: 22 additions & 0 deletions pandas/tests/extension/test_arrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ def na_value():
return pd.NA


class TestBaseCasting(base.BaseCastingTests):
pass


class TestConstructors(base.BaseConstructorsTests):
@pytest.mark.xfail(
reason=(
Expand All @@ -111,6 +115,20 @@ def test_from_dtype(self, data):
super().test_from_dtype(data)


@pytest.mark.xfail(
raises=NotImplementedError, reason="pyarrow.ChunkedArray backing is 1D."
)
class TestDim2Compat(base.Dim2CompatTests):
pass


@pytest.mark.xfail(
raises=NotImplementedError, reason="pyarrow.ChunkedArray backing is 1D."
)
class TestNDArrayBacked2D(base.NDArrayBacked2DTests):
pass


class TestGetitemTests(base.BaseGetitemTests):
@pytest.mark.xfail(
reason=(
Expand Down Expand Up @@ -179,6 +197,10 @@ def test_loc_iloc_frame_single_dtype(self, request, using_array_manager, data):
super().test_loc_iloc_frame_single_dtype(data)


class TestBaseIndex(base.BaseIndexTests):
pass


def test_arrowdtype_construct_from_string_type_with_parameters():
with pytest.raises(NotImplementedError, match="Passing pyarrow type"):
ArrowDtype.construct_from_string("timestamp[s][pyarrow]")