Skip to content

Commit ac464bc

Browse files
phoflmroeschke
authored andcommitted
BUG: ArrowDtype raising for fixed size list (pandas-dev#55000)
* BUG: ArrowDtype raising for fixed size list * Update v2.1.1.rst * Update test_arrow.py
1 parent fcc957a commit ac464bc

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

doc/source/whatsnew/v2.1.1.rst

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Fixed regressions
2929

3030
Bug fixes
3131
~~~~~~~~~
32+
- Fixed bug for :class:`ArrowDtype` raising ``NotImplementedError`` for fixed-size list (:issue:`55000`)
3233
- Fixed bug in :meth:`DataFrame.stack` with ``future_stack=True`` and columns a non-:class:`MultiIndex` consisting of tuples (:issue:`54948`)
3334

3435
.. ---------------------------------------------------------------------------

pandas/core/dtypes/dtypes.py

+2
Original file line numberDiff line numberDiff line change
@@ -2148,6 +2148,8 @@ def type(self):
21482148
return CategoricalDtypeType
21492149
elif pa.types.is_list(pa_type) or pa.types.is_large_list(pa_type):
21502150
return list
2151+
elif pa.types.is_fixed_size_list(pa_type):
2152+
return list
21512153
elif pa.types.is_map(pa_type):
21522154
return list
21532155
elif pa.types.is_struct(pa_type):

pandas/tests/extension/test_arrow.py

+9
Original file line numberDiff line numberDiff line change
@@ -2992,6 +2992,15 @@ def test_groupby_count_return_arrow_dtype(data_missing):
29922992
tm.assert_frame_equal(result, expected)
29932993

29942994

2995+
def test_fixed_size_list():
2996+
# GH#55000
2997+
ser = pd.Series(
2998+
[[1, 2], [3, 4]], dtype=ArrowDtype(pa.list_(pa.int64(), list_size=2))
2999+
)
3000+
result = ser.dtype.type
3001+
assert result == list
3002+
3003+
29953004
def test_arrowextensiondtype_dataframe_repr():
29963005
# GH 54062
29973006
df = pd.DataFrame(

0 commit comments

Comments
 (0)