Skip to content

Commit 05f5eb3

Browse files
committed
fixup
1 parent 376a0c6 commit 05f5eb3

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

pandas/core/interchange/column.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,9 @@ def describe_null(self):
197197
column_null_dtype = ColumnNullType.USE_BYTEMASK
198198
null_value = 1
199199
return column_null_dtype, null_value
200-
kind = self.dtype[0]
201200
if isinstance(self._col.dtype, ArrowDtype):
202201
return ColumnNullType.USE_BITMASK, 0
202+
kind = self.dtype[0]
203203
try:
204204
null, value = _NULL_DESCRIPTION[kind]
205205
except KeyError as err:

pandas/core/interchange/utils.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
DatetimeTZDtype,
1717
)
1818

19+
from pandas.core.arrays.boolean import BooleanDtype
20+
1921
if typing.TYPE_CHECKING:
2022
from pandas._typing import DtypeObj
2123

@@ -142,6 +144,9 @@ def dtype_to_arrow_c_fmt(dtype: DtypeObj) -> str:
142144
elif isinstance(dtype, DatetimeTZDtype):
143145
return ArrowCTypes.TIMESTAMP.format(resolution=dtype.unit[0], tz=dtype.tz)
144146

147+
elif isinstance(dtype, BooleanDtype):
148+
return ArrowCTypes.BOOL
149+
145150
raise NotImplementedError(
146151
f"Conversion of {dtype} to Arrow C format string is not implemented."
147152
)

pandas/tests/interchange/test_impl.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,6 @@ def test_nullable_integers() -> None:
424424
tm.assert_frame_equal(result, expected)
425425

426426

427-
@pytest.mark.xfail(reason="https://github.com/pandas-dev/pandas/issues/57664")
428427
def test_nullable_integers_pyarrow() -> None:
429428
# https://github.com/pandas-dev/pandas/issues/55069
430429
df = pd.DataFrame({"a": [1]}, dtype="Int8[pyarrow]")
@@ -437,12 +436,21 @@ def test_nullable_integers_pyarrow() -> None:
437436
("data", "dtype", "expected_dtype"),
438437
[
439438
([1, 2, None], "Int64", "int64"),
439+
([1, 2, None], "Int64[pyarrow]", "int64"),
440440
(
441441
[1, 2, None],
442442
"UInt64",
443443
"uint64",
444444
),
445+
(
446+
[1, 2, None],
447+
"UInt64[pyarrow]",
448+
"uint64",
449+
),
445450
([1.0, 2.25, None], "Float32", "float32"),
451+
([1.0, 2.25, None], "Float32[pyarrow]", "float32"),
452+
([True, False, None], "boolean", "bool"),
453+
([True, False, None], "boolean[pyarrow]", "bool"),
446454
],
447455
)
448456
def test_pandas_nullable_w_missing_values(

0 commit comments

Comments
 (0)