Skip to content

Commit 32cca8b

Browse files
authored
Merge branch 'main' into html-docs
2 parents 9fde26d + e0d387f commit 32cca8b

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

spec/API_specification/dataframe_api/dataframe_object.py

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from __future__ import annotations
2-
from typing import Sequence, Union, TYPE_CHECKING, NoReturn
2+
from typing import Sequence, Union, TYPE_CHECKING, NoReturn, Mapping
33

44
if TYPE_CHECKING:
55
from .column_object import Column
@@ -34,6 +34,24 @@ class DataFrame:
3434
**Methods and Attributes**
3535
3636
"""
37+
38+
@classmethod
39+
def from_dict(cls, data: Mapping[str, Column]) -> DataFrame:
40+
"""
41+
Construct DataFrame from map of column names to Columns.
42+
43+
Parameters
44+
----------
45+
data : Mapping[str, Column]
46+
Column must be of the corresponding type of the DataFrame.
47+
For example, it is only supported to build a ``LibraryXDataFrame`` using
48+
``LibraryXColumn`` instances.
49+
50+
Returns
51+
-------
52+
DataFrame
53+
"""
54+
3755
@property
3856
def dataframe(self) -> object:
3957
"""
@@ -111,24 +129,18 @@ def get_columns_by_name(self, names: Sequence[str], /) -> DataFrame:
111129
"""
112130
...
113131

114-
def get_rows(self, indices: Sequence[int]) -> DataFrame:
132+
def get_rows(self, indices: "Column[int]") -> DataFrame:
115133
"""
116134
Select a subset of rows, similar to `ndarray.take`.
117135
118136
Parameters
119137
----------
120-
indices : Sequence[int]
138+
indices : Column[int]
121139
Positions of rows to select.
122140
123141
Returns
124142
-------
125143
DataFrame
126-
127-
Notes
128-
-----
129-
Some discussion participants prefer a stricter type Column[int] for
130-
indices in order to make it easier to implement in a performant manner
131-
on GPUs.
132144
"""
133145
...
134146

0 commit comments

Comments
 (0)