Skip to content

Commit d2c4db1

Browse files
committed
ENH: Support for PyArrow JSON type in ArrowDtype.type
Improved extension type handling by using BaseExtensionType for consistent storage type resolution across all PyArrow extension types, including JSON. Fixes #60958
1 parent 05afdd6 commit d2c4db1

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

doc/source/whatsnew/v3.0.0.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ Other enhancements
6161
- :meth:`Series.cummin` and :meth:`Series.cummax` now supports :class:`CategoricalDtype` (:issue:`52335`)
6262
- :meth:`Series.plot` now correctly handle the ``ylabel`` parameter for pie charts, allowing for explicit control over the y-axis label (:issue:`58239`)
6363
- :meth:`DataFrame.plot.scatter` argument ``c`` now accepts a column of strings, where rows with the same string are colored identically (:issue:`16827` and :issue:`16485`)
64+
- :class:`ArrowDtype` now supports ``pyarrowJsonType`` (:issue:`60958`)
6465
- :class:`DataFrameGroupBy` and :class:`SeriesGroupBy` methods ``sum``, ``mean``, ``median``, ``prod``, ``min``, ``max``, ``std``, ``var`` and ``sem`` now accept ``skipna`` parameter (:issue:`15675`)
6566
- :class:`Rolling` and :class:`Expanding` now support ``nunique`` (:issue:`26958`)
6667
- :class:`Rolling` and :class:`Expanding` now support aggregations ``first`` and ``last`` (:issue:`33155`)
6768
- :func:`read_parquet` accepts ``to_pandas_kwargs`` which are forwarded to :meth:`pyarrow.Table.to_pandas` which enables passing additional keywords to customize the conversion to pandas, such as ``maps_as_pydicts`` to read the Parquet map data type as python dictionaries (:issue:`56842`)
68-
- :meth: ``ArrowDtype.type`` now supports the pyarrow json data type (:issue:`60958`)
6969
- :meth:`.DataFrameGroupBy.transform`, :meth:`.SeriesGroupBy.transform`, :meth:`.DataFrameGroupBy.agg`, :meth:`.SeriesGroupBy.agg`, :meth:`.SeriesGroupBy.apply`, :meth:`.DataFrameGroupBy.apply` now support ``kurt`` (:issue:`40139`)
7070
- :meth:`DataFrameGroupBy.transform`, :meth:`SeriesGroupBy.transform`, :meth:`DataFrameGroupBy.agg`, :meth:`SeriesGroupBy.agg`, :meth:`RollingGroupby.apply`, :meth:`ExpandingGroupby.apply`, :meth:`Rolling.apply`, :meth:`Expanding.apply`, :meth:`DataFrame.apply` with ``engine="numba"`` now supports positional arguments passed as kwargs (:issue:`58995`)
7171
- :meth:`Rolling.agg`, :meth:`Expanding.agg` and :meth:`ExponentialMovingWindow.agg` now accept :class:`NamedAgg` aggregations through ``**kwargs`` (:issue:`28333`)

pandas/core/dtypes/dtypes.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -2265,10 +2265,8 @@ def type(self):
22652265
elif pa.types.is_null(pa_type):
22662266
# TODO: None? pd.NA? pa.null?
22672267
return type(pa_type)
2268-
elif isinstance(pa_type, pa.ExtensionType):
2268+
elif isinstance(pa_type, pa.BaseExtensionType):
22692269
return type(self)(pa_type.storage_type).type
2270-
elif isinstance(pa_type, pa.JsonType):
2271-
return str
22722270
raise NotImplementedError(pa_type)
22732271

22742272
@property

0 commit comments

Comments
 (0)