-
-
Notifications
You must be signed in to change notification settings - Fork 19.4k
Enh arrow json extension #61103
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
Enh arrow json extension #61103
Conversation
pandas/core/dtypes/dtypes.py
Outdated
| elif isinstance(pa_type, pa.ExtensionType): | ||
| return type(self)(pa_type.storage_type).type | ||
| elif isinstance(pa_type, pa.JsonType): | ||
| return str |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| elif isinstance(pa_type, pa.ExtensionType): | |
| return type(self)(pa_type.storage_type).type | |
| elif isinstance(pa_type, pa.JsonType): | |
| return str | |
| elif isinstance(pa_type, pa.BaseExtensionType): | |
| return type(self)(pa_type.storage_type).type |
doc/source/whatsnew/v3.0.0.rst
Outdated
| - :class:`Rolling` and :class:`Expanding` now support ``nunique`` (:issue:`26958`) | ||
| - :class:`Rolling` and :class:`Expanding` now support aggregations ``first`` and ``last`` (:issue:`33155`) | ||
| - :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`) | ||
| - :meth: ``ArrowDtype.type`` now supports the pyarrow json data type (:issue:`60958`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| - :meth: ``ArrowDtype.type`` now supports the pyarrow json data type (:issue:`60958`) | |
| - :class:`ArrowDtype` now supports ``pyarrowJsonType`` (:issue:`60958`) |
doc/source/whatsnew/v3.0.0.rst
Outdated
| - :meth:`Series.cummin` and :meth:`Series.cummax` now supports :class:`CategoricalDtype` (:issue:`52335`) | ||
| - :meth:`Series.plot` now correctly handle the ``ylabel`` parameter for pie charts, allowing for explicit control over the y-axis label (:issue:`58239`) | ||
| - :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`) | ||
| - :class:`ArrowDtype` now supports ``pyarrowJsonType`` (:issue:`60958`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| - :class:`ArrowDtype` now supports ``pyarrowJsonType`` (:issue:`60958`) | |
| - :class:`ArrowDtype` now supports ``pyarrow.JsonType`` (:issue:`60958`) |
| tm.assert_series_equal(result, expected) | ||
|
|
||
|
|
||
| def test_arrow_json_type(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll need to @pytest.mark.skipif(pa_version_under19p0, reason=...) as pa.json_ is new as of Pyarrow 19
Added support for PyArrow's JSON extension type in ArrowDtype.type by mapping JsonType to str. Fixes pandas-dev#60958.
d2c4db1 to
dced6fa
Compare
Improved extension type handling by using BaseExtensionType for consistent storage type resolution across all PyArrow extension types, including JSON. Fixes pandas-dev#60958
dced6fa to
a945971
Compare
|
Thanks @asharmalik19 |
|
Thanks @mroeschke for such quick feedback |
|
Thank you so much for your help, @asharmalik19 and @mroeschke ! |
|
@mroeschke Is there any chance this fix for arrow extension types could get back ported to pandas 2.x or do we need to wait for 3.x? |
|
I don't think the team is planning on making another 2.x release. We ideally will be releasing a 3.0rc this week or next cc @jbrockmendel |
|
@mroeschke There has been some new backported commits to |
pa.json_in arrow extension type #60958doc/source/whatsnew/vX.X.X.rstfile if fixing a bug or adding a new feature.