@@ -27,25 +27,20 @@ class PandasDataFrameXchg(DataFrameXchg):
27
27
attributes defined on this class.
28
28
"""
29
29
30
- def __init__ (
31
- self , df : DataFrame , nan_as_null : bool = False , allow_copy : bool = True
32
- ) -> None :
30
+ def __init__ (self , df : DataFrame , allow_copy : bool = True ) -> None :
33
31
"""
34
32
Constructor - an instance of this (private) class is returned from
35
33
`pd.DataFrame.__dataframe__`.
36
34
"""
37
35
self ._df = df
38
- # ``nan_as_null`` is a keyword intended for the consumer to tell the
39
- # producer to overwrite null values in the data with ``NaN`` (or ``NaT``).
40
- # This currently has no effect; once support for nullable extension
41
- # dtypes is added, this value should be propagated to columns.
42
- self ._nan_as_null = nan_as_null
43
36
self ._allow_copy = allow_copy
44
37
45
38
def __dataframe__ (
46
39
self , nan_as_null : bool = False , allow_copy : bool = True
47
40
) -> PandasDataFrameXchg :
48
- return PandasDataFrameXchg (self ._df , nan_as_null , allow_copy )
41
+ # `nan_as_null` can be removed here once it's removed from
42
+ # Dataframe.__dataframe__
43
+ return PandasDataFrameXchg (self ._df , allow_copy )
49
44
50
45
@property
51
46
def metadata (self ) -> dict [str , Index ]:
@@ -84,7 +79,7 @@ def select_columns(self, indices: Sequence[int]) -> PandasDataFrameXchg:
84
79
indices = list (indices )
85
80
86
81
return PandasDataFrameXchg (
87
- self ._df .iloc [:, indices ], self . _nan_as_null , self ._allow_copy
82
+ self ._df .iloc [:, indices ], allow_copy = self ._allow_copy
88
83
)
89
84
90
85
def select_columns_by_name (self , names : list [str ]) -> PandasDataFrameXchg : # type: ignore[override]
@@ -93,9 +88,7 @@ def select_columns_by_name(self, names: list[str]) -> PandasDataFrameXchg: # ty
93
88
if not isinstance (names , list ):
94
89
names = list (names )
95
90
96
- return PandasDataFrameXchg (
97
- self ._df .loc [:, names ], self ._nan_as_null , self ._allow_copy
98
- )
91
+ return PandasDataFrameXchg (self ._df .loc [:, names ], allow_copy = self ._allow_copy )
99
92
100
93
def get_chunks (self , n_chunks : int | None = None ) -> Iterable [PandasDataFrameXchg ]:
101
94
"""
@@ -109,8 +102,7 @@ def get_chunks(self, n_chunks: int | None = None) -> Iterable[PandasDataFrameXch
109
102
for start in range (0 , step * n_chunks , step ):
110
103
yield PandasDataFrameXchg (
111
104
self ._df .iloc [start : start + step , :],
112
- self ._nan_as_null ,
113
- self ._allow_copy ,
105
+ allow_copy = self ._allow_copy ,
114
106
)
115
107
else :
116
108
yield self
0 commit comments