From 0378af9192d2b627fe41863f2a75c37883e1ff9f Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Wed, 3 Aug 2022 08:55:56 +0200 Subject: [PATCH] DOC: more exchange -> interchange renames --- doc/source/whatsnew/v1.5.0.rst | 22 +++++++++++----------- pandas/core/interchange/from_dataframe.py | 2 +- pandas/tests/interchange/test_impl.py | 4 ++-- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/doc/source/whatsnew/v1.5.0.rst b/doc/source/whatsnew/v1.5.0.rst index 6e38024e02f36..3225195513fe5 100644 --- a/doc/source/whatsnew/v1.5.0.rst +++ b/doc/source/whatsnew/v1.5.0.rst @@ -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: diff --git a/pandas/core/interchange/from_dataframe.py b/pandas/core/interchange/from_dataframe.py index ae9b39de54d41..a430e0c66a988 100644 --- a/pandas/core/interchange/from_dataframe.py +++ b/pandas/core/interchange/from_dataframe.py @@ -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 diff --git a/pandas/tests/interchange/test_impl.py b/pandas/tests/interchange/test_impl.py index 5168e1acc8e7e..4c4c2a99c5558 100644 --- a/pandas/tests/interchange/test_impl.py +++ b/pandas/tests/interchange/test_impl.py @@ -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():