[Python] Pandas is deprecating dataframe interchange protocol
- Dominant language
- C++
- Stars
- 17.1k
- Forks
- 4.3k
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 88
Description
### Describe the enhancement requested
New warnings are appearing with pytest and doctest:
```python
/opt/conda/envs/arrow/lib/python3.11/site-packages/pyarrow/interchange/from_dataframe.py:113: Pandas4Warning: The Dataframe Interchange Protocol is deprecated.
For dataframe-agnostic code, you may want to look into:
- Arrow PyCapsule Interface: https://arrow.apache.org/docs/format/CDataInterface/PyCapsuleInterface.html
- Narwhals: https://github.com/narwhals-dev/narwhals
return _from_dataframe(df.__dataframe__(allow_copy=allow_copy),
```
due to Pandas moving the dataframe interchange protocol out of the repo in the next major release (4.0.0), see:
- warnings in doctest: https://github.com/apache/arrow/actions/runs/23557627928/job/68588688057?pr=49377#step:6:4433
- warning in pytest: https://github.com/apache/arrow/actions/runs/23557627928/job/68588688057?pr=49377#step:6:4392
- pandas deprecation issue: https://github.com/pandas-dev/pandas/issues/56732
Two things that come to mind:
- for the time being, which library to use in the [conversion tests](https://github.com/apache/arrow/blob/main/python/pyarrow/tests/interchange/test_conversion.py) and [documentation examples](https://github.com/apache/arrow/blob/main/docs/source/python/interchange_protocol.rst)? Maybe Polars? @jorisvandenbossche I am not sure if there is a plan to have a separate pandas interchange package or that was just an initial idea and pandas plans to completely move away from the protocol?
- How long to keep the implementation of the protocol in PyArrow. I think we should maintain it for a while. There has been not much of maintainance burden so far. The only problem is that feature requests are stuck due to the dataframe interchange protocol project being idle.
### Component(s)
Python
Contributor guide
Assessment
This issue has not been assessed yet.