File tree Expand file tree Collapse file tree 2 files changed +36
-3
lines changed
spec/API_specification/dataframe_api Expand file tree Collapse file tree 2 files changed +36
-3
lines changed Original file line number Diff line number Diff line change 55if TYPE_CHECKING :
66 from .typing import NullType , Scalar , DType , Namespace
77 from typing_extensions import Self
8+ from dataframe_api .dataframe_object import DataFrame
89
910
1011__all__ = ['Column' ]
@@ -17,8 +18,30 @@ class Column(Protocol):
1718 Note that this column object is not meant to be instantiated directly by
1819 users of the library implementing the dataframe API standard. Rather, use
1920 constructor functions or an already-created dataframe object retrieved via
20-
21+ :meth:`DataFrame.col`.
2122 """
23+ @property
24+ def dataframe (self ) -> DataFrame | None :
25+ """
26+ Return parent DataFrame, if present.
27+
28+ For example, if we have the following
29+
30+ .. code-block:: python
31+
32+ df: DataFrame
33+ column = df.col('a')
34+
35+ then `column.dataframe` should return `df`.
36+
37+ On the other hand, if we had:
38+
39+ .. code-block:: python
40+
41+ column = column_from_1d_array(...)
42+
43+ then `column.dataframe` should return `None`.
44+ """
2245
2346 def __column_namespace__ (self ) -> Namespace :
2447 """
Original file line number Diff line number Diff line change @@ -142,6 +142,11 @@ def get_rows(self, indices: Column) -> Self:
142142 Returns
143143 -------
144144 DataFrame
145+
146+ Notes
147+ -----
148+ `indices`'s parent DataFrame must be `self` - else,
149+ the operation is unsupported and may vary across implementations.
145150 """
146151 ...
147152
@@ -177,8 +182,8 @@ def filter(self, mask: Column) -> Self:
177182
178183 Notes
179184 -----
180- Some participants preferred a weaker type Arraylike[bool] for mask ,
181- where 'Arraylike' denotes an object adhering to the Array API standard .
185+ `mask`'s parent DataFrame must be `self` - else ,
186+ the operation is unsupported and may vary across implementations .
182187 """
183188 ...
184189
@@ -207,6 +212,11 @@ def assign(self, *columns: Column) -> Self:
207212 Returns
208213 -------
209214 DataFrame
215+
216+ Notes
217+ -----
218+ All of `columns`'s parent DataFrame must be `self` - else,
219+ the operation is unsupported and may vary across implementations.
210220 """
211221 ...
212222
You can’t perform that action at this time.
0 commit comments