Skip to content

Commit

Permalink
Backport PR pandas-dev#55000: BUG: ArrowDtype raising for fixed size …
Browse files Browse the repository at this point in the history
…list
  • Loading branch information
phofl authored and meeseeksmachine committed Sep 5, 2023
1 parent 0c03254 commit 09f2f38
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/source/whatsnew/v2.1.1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Fixed regressions

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

.. ---------------------------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions pandas/core/dtypes/dtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2109,6 +2109,8 @@ def type(self):
return CategoricalDtypeType
elif pa.types.is_list(pa_type) or pa.types.is_large_list(pa_type):
return list
elif pa.types.is_fixed_size_list(pa_type):
return list
elif pa.types.is_map(pa_type):
return list
elif pa.types.is_struct(pa_type):
Expand Down
9 changes: 9 additions & 0 deletions pandas/tests/extension/test_arrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -3037,6 +3037,15 @@ def test_groupby_count_return_arrow_dtype(data_missing):
tm.assert_frame_equal(result, expected)


def test_fixed_size_list():
# GH#55000
ser = pd.Series(
[[1, 2], [3, 4]], dtype=ArrowDtype(pa.list_(pa.int64(), list_size=2))
)
result = ser.dtype.type
assert result == list


def test_arrowextensiondtype_dataframe_repr():
# GH 54062
df = pd.DataFrame(
Expand Down

0 comments on commit 09f2f38

Please sign in to comment.