Skip to content

Commit 02ab370

Browse files
authored
BUG: ArrowDtype().type raising for fixed size pa binary (#51674)
BUG: is_numeric raising for fixed size pa binary
1 parent 3d47fb9 commit 02ab370

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

pandas/core/arrays/arrow/dtype.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,11 @@ def type(self):
108108
return float
109109
elif pa.types.is_string(pa_type):
110110
return str
111-
elif pa.types.is_binary(pa_type):
111+
elif (
112+
pa.types.is_binary(pa_type)
113+
or pa.types.is_fixed_size_binary(pa_type)
114+
or pa.types.is_large_binary(pa_type)
115+
):
112116
return bytes
113117
elif pa.types.is_boolean(pa_type):
114118
return bool

pandas/tests/extension/test_arrow.py

+5
Original file line numberDiff line numberDiff line change
@@ -1394,6 +1394,11 @@ def test_mode_dropna_false_mode_na(data):
13941394
tm.assert_series_equal(result, expected)
13951395

13961396

1397+
@pytest.mark.parametrize("arrow_dtype", [pa.binary(), pa.binary(16), pa.large_binary()])
1398+
def test_arrow_dtype_type(arrow_dtype):
1399+
assert ArrowDtype(arrow_dtype).type == bytes
1400+
1401+
13971402
def test_is_bool_dtype():
13981403
# GH 22667
13991404
data = ArrowExtensionArray(pa.array([True, False, True]))

0 commit comments

Comments
 (0)