Skip to content

Commit e0d387f

Browse files
authored
Add from_dict classmethod (#112)
1 parent 6585fd7 commit e0d387f

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

spec/API_specification/dataframe_api/dataframe_object.py

Lines changed: 18 additions & 1 deletion
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
@@ -11,6 +11,23 @@
1111

1212

1313
class DataFrame:
14+
@classmethod
15+
def from_dict(cls, data: Mapping[str, Column]) -> DataFrame:
16+
"""
17+
Construct DataFrame from map of column names to Columns.
18+
19+
Parameters
20+
----------
21+
data : Mapping[str, Column]
22+
Column must be of the corresponding type of the DataFrame.
23+
For example, it is only supported to build a ``LibraryXDataFrame`` using
24+
``LibraryXColumn`` instances.
25+
26+
Returns
27+
-------
28+
DataFrame
29+
"""
30+
1431
@property
1532
def dataframe(self) -> object:
1633
"""

0 commit comments

Comments
 (0)