Skip to content

Commit d64e5e4

Browse files
committed
Respond to review - move files around
Signed-off-by: Vasily Litvinov <vasilij.n.litvinov@intel.com>
1 parent a407339 commit d64e5e4

File tree

8 files changed

+24
-8
lines changed

8 files changed

+24
-8
lines changed

pandas/api/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
""" public toolkit API """
22
from pandas.api import ( # noqa:F401
3+
exchange,
34
extensions,
45
indexers,
56
types,

pandas/api/exchange/__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 exchange protocol.
3+
"""
4+
5+
from pandas.core.exchange.implementation import from_dataframe
6+
from pandas.core.exchange.dataframe_protocol import DataFrame
7+
8+
__all__ = ["from_dataframe", "DataFrame"]

pandas/core/exchange/__init__.py

Whitespace-only changes.

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
"""
2+
A verbatim copy (vendored) of the spec from https://github.com/data-apis/dataframe-api
3+
"""
4+
15
from typing import Tuple, Optional, Dict, Any, Iterable, Sequence, TypedDict
26
import enum
37
from abc import ABC, abstractmethod

pandas/api/exchange/implementation.py renamed to pandas/core/exchange/implementation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
from typing import Tuple, Any
55

6-
from .dataframe_protocol import (
6+
from pandas.core.exchange.dataframe_protocol import (
77
Buffer,
88
Column,
99
ColumnNullType,

pandas/core/frame.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,6 @@
204204
nargsort,
205205
)
206206

207-
from pandas.api.exchange.dataframe_protocol import DataFrame as DataFrameXchg
208-
209207
from pandas.io.common import get_handle
210208
from pandas.io.formats import (
211209
console,
@@ -223,7 +221,7 @@
223221
from pandas.core.groupby.generic import DataFrameGroupBy
224222
from pandas.core.internals import SingleDataManager
225223
from pandas.core.resample import Resampler
226-
224+
from pandas.core.exchange.dataframe_protocol import DataFrame as DataFrameXchg
227225
from pandas.io.formats.style import Styler
228226

229227
# ---------------------------------------------------------------------
@@ -814,8 +812,9 @@ def __init__(
814812
NDFrame.__init__(self, mgr)
815813

816814
# ----------------------------------------------------------------------
817-
def __dataframe__(self, nan_as_null : bool = False,
818-
allow_copy : bool = True) -> DataFrameXchg:
815+
def __dataframe__(
816+
self, nan_as_null: bool = False, allow_copy: bool = True
817+
) -> DataFrameXchg:
819818
"""
820819
Return the dataframe exchange object implementing the exchange protocol.
821820
@@ -825,7 +824,8 @@ def __dataframe__(self, nan_as_null : bool = False,
825824
https://data-apis.org/dataframe-protocol/latest/index.html
826825
"""
827826

828-
from pandas.api.exchange.implementation import _PandasDataFrameXchg
827+
from pandas.core.exchange.implementation import _PandasDataFrameXchg
828+
829829
return _PandasDataFrameXchg(self, nan_as_null, allow_copy)
830830

831831
# ----------------------------------------------------------------------

pandas/tests/api/conftest.py renamed to pandas/tests/exchange/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import pytest
22
import pandas as pd
3-
from pandas.api.exchange.implementation import _from_dataframe
3+
from pandas.core.exchange.implementation import _from_dataframe
44

55

66
@pytest.fixture(scope="package")

pandas/tests/api/test_protocol.py renamed to pandas/tests/exchange/test_protocol.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
"""
2+
A verbatim copy (vendored) of the spec tests from https://github.com/data-apis/dataframe-api
3+
"""
14
import pytest
25
import math
36
import ctypes

0 commit comments

Comments
 (0)