Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/source/whatsnew/v2.2.2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Fixed regressions

Bug fixes
~~~~~~~~~
- :meth:`DataFrame.__dataframe__` was producing incorrect data buffers when the column's type was nullable boolean (:issue:`55332`)
- :meth:`DataFrame.__dataframe__` was showing bytemask instead of bitmask for ``'string[pyarrow]'`` validity buffer (:issue:`57762`)
- :meth:`DataFrame.__dataframe__` was showing non-null validity buffer (instead of ``None``) ``'string[pyarrow]'`` without missing values (:issue:`57761`)

Expand Down
3 changes: 3 additions & 0 deletions pandas/core/interchange/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ def dtype_to_arrow_c_fmt(dtype: DtypeObj) -> str:
elif isinstance(dtype, DatetimeTZDtype):
return ArrowCTypes.TIMESTAMP.format(resolution=dtype.unit[0], tz=dtype.tz)

elif isinstance(dtype, pd.BooleanDtype):
return ArrowCTypes.BOOL

raise NotImplementedError(
f"Conversion of {dtype} to Arrow C format string is not implemented."
)
Expand Down
2 changes: 2 additions & 0 deletions pandas/tests/interchange/test_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,7 @@ def test_non_str_names_w_duplicates():
),
([1.0, 2.25, None], "Float32", "float32"),
([1.0, 2.25, None], "Float32[pyarrow]", "float32"),
([True, False, None], "boolean", "bool"),
([True, False, None], "boolean[pyarrow]", "bool"),
(["much ado", "about", None], "string[pyarrow_numpy]", "large_string"),
(["much ado", "about", None], "string[pyarrow]", "large_string"),
Expand Down Expand Up @@ -532,6 +533,7 @@ def test_pandas_nullable_with_missing_values(
),
([1.0, 2.25, 5.0], "Float32", "float32"),
([1.0, 2.25, 5.0], "Float32[pyarrow]", "float32"),
([True, False, False], "boolean", "bool"),
([True, False, False], "boolean[pyarrow]", "bool"),
(["much ado", "about", "nothing"], "string[pyarrow_numpy]", "large_string"),
(["much ado", "about", "nothing"], "string[pyarrow]", "large_string"),
Expand Down