Skip to content

Commit 26a5ded

Browse files
committed
WIP: Support PyArrow JSON type in ArrowDtype.type
1 parent 40a8180 commit 26a5ded

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

pandas/core/dtypes/dtypes.py

+2
Original file line numberDiff line numberDiff line change
@@ -2267,6 +2267,8 @@ def type(self):
22672267
return type(pa_type)
22682268
elif isinstance(pa_type, pa.ExtensionType):
22692269
return type(self)(pa_type.storage_type).type
2270+
elif isinstance(pa_type, pa.JsonType):
2271+
return str
22702272
raise NotImplementedError(pa_type)
22712273

22722274
@property

pandas/tests/extension/test_arrow.py

+8
Original file line numberDiff line numberDiff line change
@@ -3553,3 +3553,11 @@ def test_categorical_from_arrow_dictionary():
35533553
dtype="int64",
35543554
)
35553555
tm.assert_series_equal(result, expected)
3556+
3557+
3558+
def test_arrow_json_type():
3559+
# GH 60958
3560+
3561+
dtype = pd.ArrowDtype(pa.json_(pa.string()))
3562+
result = pd.api.types.pandas_dtype(dtype).type
3563+
assert result == str

0 commit comments

Comments
 (0)