Skip to content

Commit 76de473

Browse files
authored
REF: Rename exchange -> interchange (#47888)
1 parent 62a69be commit 76de473

File tree

18 files changed

+35
-35
lines changed

18 files changed

+35
-35
lines changed

doc/source/reference/general_functions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,4 @@ Importing from other DataFrame libraries
8585
.. autosummary::
8686
:toctree: api/
8787

88-
api.exchange.from_dataframe
88+
api.interchange.from_dataframe

pandas/api/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
""" public toolkit API """
22
from pandas.api import (
3-
exchange,
43
extensions,
54
indexers,
5+
interchange,
66
types,
77
)
88

99
__all__ = [
10-
"exchange",
10+
"interchange",
1111
"extensions",
1212
"indexers",
1313
"types",

pandas/api/exchange/__init__.py

Lines changed: 0 additions & 8 deletions
This file was deleted.

pandas/api/interchange/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
"""
2+
Public API for DataFrame interchange protocol.
3+
"""
4+
5+
from pandas.core.interchange.dataframe_protocol import DataFrame
6+
from pandas.core.interchange.from_dataframe import from_dataframe
7+
8+
__all__ = ["from_dataframe", "DataFrame"]

pandas/core/frame.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,8 @@
220220

221221
if TYPE_CHECKING:
222222

223-
from pandas.core.exchange.dataframe_protocol import DataFrame as DataFrameXchg
224223
from pandas.core.groupby.generic import DataFrameGroupBy
224+
from pandas.core.interchange.dataframe_protocol import DataFrame as DataFrameXchg
225225
from pandas.core.internals import SingleDataManager
226226
from pandas.core.resample import Resampler
227227

@@ -819,7 +819,7 @@ def __dataframe__(
819819
self, nan_as_null: bool = False, allow_copy: bool = True
820820
) -> DataFrameXchg:
821821
"""
822-
Return the dataframe exchange object implementing the exchange protocol.
822+
Return the dataframe interchange object implementing the interchange protocol.
823823
824824
Parameters
825825
----------
@@ -832,19 +832,19 @@ def __dataframe__(
832832
833833
Returns
834834
-------
835-
DataFrame exchange object
835+
DataFrame interchange object
836836
The object which consuming library can use to ingress the dataframe.
837837
838838
Notes
839839
-----
840-
Details on the exchange protocol:
840+
Details on the interchange protocol:
841841
https://data-apis.org/dataframe-protocol/latest/index.html
842842
843843
`nan_as_null` currently has no effect; once support for nullable extension
844844
dtypes is added, this value should be propagated to columns.
845845
"""
846846

847-
from pandas.core.exchange.dataframe import PandasDataFrameXchg
847+
from pandas.core.interchange.dataframe import PandasDataFrameXchg
848848

849849
return PandasDataFrameXchg(self, nan_as_null, allow_copy)
850850

pandas/core/exchange/buffer.py renamed to pandas/core/interchange/buffer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import numpy as np
44
from packaging import version
55

6-
from pandas.core.exchange.dataframe_protocol import (
6+
from pandas.core.interchange.dataframe_protocol import (
77
Buffer,
88
DlpackDeviceType,
99
)

pandas/core/exchange/column.py renamed to pandas/core/interchange/column.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
is_categorical_dtype,
1313
is_string_dtype,
1414
)
15-
from pandas.core.exchange.buffer import PandasBuffer
16-
from pandas.core.exchange.dataframe_protocol import (
15+
from pandas.core.interchange.buffer import PandasBuffer
16+
from pandas.core.interchange.dataframe_protocol import (
1717
Column,
1818
ColumnBuffers,
1919
ColumnNullType,
2020
DtypeKind,
2121
)
22-
from pandas.core.exchange.utils import (
22+
from pandas.core.interchange.utils import (
2323
ArrowCTypes,
2424
Endianness,
2525
NoBufferPresent,
@@ -136,7 +136,7 @@ def _dtype_from_pandasdtype(self, dtype) -> tuple[DtypeKind, int, str, str]:
136136
kind = _NP_KINDS.get(dtype.kind, None)
137137
if kind is None:
138138
# Not a NumPy dtype. Check if it's a categorical maybe
139-
raise ValueError(f"Data type {dtype} not supported by exchange protocol")
139+
raise ValueError(f"Data type {dtype} not supported by interchange protocol")
140140

141141
return kind, dtype.itemsize * 8, dtype_to_arrow_c_fmt(dtype), dtype.byteorder
142142

pandas/core/exchange/dataframe.py renamed to pandas/core/interchange/dataframe.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
from typing import TYPE_CHECKING
55

66
import pandas as pd
7-
from pandas.core.exchange.column import PandasColumn
8-
from pandas.core.exchange.dataframe_protocol import DataFrame as DataFrameXchg
7+
from pandas.core.interchange.column import PandasColumn
8+
from pandas.core.interchange.dataframe_protocol import DataFrame as DataFrameXchg
99

1010
if TYPE_CHECKING:
1111
from pandas import Index

pandas/core/exchange/dataframe_protocol.py renamed to pandas/core/interchange/dataframe_protocol.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ class DataFrame(ABC):
389389

390390
@abstractmethod
391391
def __dataframe__(self, nan_as_null: bool = False, allow_copy: bool = True):
392-
"""Construct a new exchange object, potentially changing the parameters."""
392+
"""Construct a new interchange object, potentially changing the parameters."""
393393
pass
394394

395395
@property

0 commit comments

Comments
 (0)