Skip to content

Commit be45d4e

Browse files
mroeschkeyehoshuadimarsky
authored andcommitted
ENH/TST: ArrowExtenstionArray.reshape raises NotImplementedError (pandas-dev#47302)
1 parent 0efc21b commit be45d4e

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

pandas/core/arrays/arrow/array.py

+6
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,12 @@ def factorize(self, na_sentinel: int = -1) -> tuple[np.ndarray, ExtensionArray]:
264264

265265
return indices.values, uniques
266266

267+
def reshape(self, *args, **kwargs):
268+
raise NotImplementedError(
269+
f"{type(self)} does not support reshape "
270+
f"as backed by a 1D pyarrow.ChunkedArray."
271+
)
272+
267273
def take(
268274
self,
269275
indices: TakeIndexer,

pandas/tests/extension/test_arrow.py

+22
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ def na_value():
9999
return pd.NA
100100

101101

102+
class TestBaseCasting(base.BaseCastingTests):
103+
pass
104+
105+
102106
class TestConstructors(base.BaseConstructorsTests):
103107
@pytest.mark.xfail(
104108
reason=(
@@ -111,6 +115,20 @@ def test_from_dtype(self, data):
111115
super().test_from_dtype(data)
112116

113117

118+
@pytest.mark.xfail(
119+
raises=NotImplementedError, reason="pyarrow.ChunkedArray backing is 1D."
120+
)
121+
class TestDim2Compat(base.Dim2CompatTests):
122+
pass
123+
124+
125+
@pytest.mark.xfail(
126+
raises=NotImplementedError, reason="pyarrow.ChunkedArray backing is 1D."
127+
)
128+
class TestNDArrayBacked2D(base.NDArrayBacked2DTests):
129+
pass
130+
131+
114132
class TestGetitemTests(base.BaseGetitemTests):
115133
@pytest.mark.xfail(
116134
reason=(
@@ -179,6 +197,10 @@ def test_loc_iloc_frame_single_dtype(self, request, using_array_manager, data):
179197
super().test_loc_iloc_frame_single_dtype(data)
180198

181199

200+
class TestBaseIndex(base.BaseIndexTests):
201+
pass
202+
203+
182204
def test_arrowdtype_construct_from_string_type_with_parameters():
183205
with pytest.raises(NotImplementedError, match="Passing pyarrow type"):
184206
ArrowDtype.construct_from_string("timestamp[s][pyarrow]")

0 commit comments

Comments
 (0)