Skip to content

DOC: more exchange -> interchange renames #47940

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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
22 changes: 11 additions & 11 deletions doc/source/whatsnew/v1.5.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,23 @@ including other versions of pandas.
Enhancements
~~~~~~~~~~~~

.. _whatsnew_150.enhancements.dataframe_exchange:
.. _whatsnew_150.enhancements.dataframe_interchange:

DataFrame exchange protocol implementation
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
DataFrame interchange protocol implementation
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Pandas now implement the DataFrame exchange API spec.
Pandas now implement the DataFrame interchange API spec.
See the full details on the API at https://data-apis.org/dataframe-protocol/latest/index.html

The protocol consists of two parts:

- New method :meth:`DataFrame.__dataframe__` which produces the exchange object.
It effectively "exports" the Pandas dataframe as an exchange object so
any other library which has the protocol implemented can "import" that dataframe
without knowing anything about the producer except that it makes an exchange object.
- New function :func:`pandas.api.exchange.from_dataframe` which can take
an arbitrary exchange object from any conformant library and construct a
Pandas DataFrame out of it.
- New method :meth:`DataFrame.__dataframe__` which produces the interchange object.
It effectively "exports" the pandas dataframe as an interchange object so
any other library which has the protocol implemented can "import" that dataframe
without knowing anything about the producer except that it makes an interchange object.
- New function :func:`pandas.api.interchange.from_dataframe` which can take
an arbitrary interchange object from any conformant library and construct a
pandas DataFrame out of it.

.. _whatsnew_150.enhancements.styler:

Expand Down
2 changes: 1 addition & 1 deletion pandas/core/interchange/from_dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def protocol_df_chunk_to_pandas(df: DataFrameXchg) -> pd.DataFrame:
buffers.append(buf)

pandas_df = pd.DataFrame(columns)
pandas_df.attrs["_EXCHANGE_PROTOCOL_BUFFERS"] = buffers
pandas_df.attrs["_INTERCHANGE_PROTOCOL_BUFFERS"] = buffers
return pandas_df


Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/interchange/test_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ def test_dataframe(data):
expected = from_dataframe(df2.select_columns_by_name(names))
tm.assert_frame_equal(result, expected)

assert isinstance(result.attrs["_EXCHANGE_PROTOCOL_BUFFERS"], list)
assert isinstance(expected.attrs["_EXCHANGE_PROTOCOL_BUFFERS"], list)
assert isinstance(result.attrs["_INTERCHANGE_PROTOCOL_BUFFERS"], list)
assert isinstance(expected.attrs["_INTERCHANGE_PROTOCOL_BUFFERS"], list)


def test_missing_from_masked():
Expand Down