Skip to content

move from_sequence to namespace #164

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 11, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions spec/API_specification/dataframe_api/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,54 @@
"""
Function stubs and API documentation for the DataFrame API standard.
"""
from __future__ import annotations

from typing import Mapping, Sequence

from .column_object import *
from .dataframe_object import *
from .groupby_object import *

from ._types import dtype


__dataframe_api_version__: str = "YYYY.MM"
"""
String representing the version of the DataFrame API specification to which the
conforming implementation adheres.
"""

def column_from_sequence(sequence: Sequence[object], dtype: dtype) -> Column:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider making dtype keyword-only?

"""
Construct Column from sequence of elements.

Parameters
----------
sequence : Sequence[object]
Sequence of elements. Each element must be of the specified
``dtype``, the corresponding Python builtin scalar type, or
coercible to that Python scalar type.
dtype : str
Dtype of result. Must be specified.

Returns
-------
Column
"""
...

def dataframe_from_dict(data: Mapping[str, Column]) -> DataFrame:
"""
Construct DataFrame from map of column names to Columns.

Parameters
----------
data : Mapping[str, Column]
Column must be of the corresponding type of the DataFrame.
For example, it is only supported to build a ``LibraryXDataFrame`` using
``LibraryXColumn`` instances.

Returns
-------
DataFrame
"""
20 changes: 0 additions & 20 deletions spec/API_specification/dataframe_api/column_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,6 @@ class Column:
constructor functions or an already-created dataframe object retrieved via

"""
@classmethod
def from_sequence(cls, sequence: Sequence[object], dtype: dtype) -> Column:
"""
Construct Column from sequence of elements.

Parameters
----------
sequence : Sequence[object]
Sequence of elements. Each element must be of the specified
``dtype``, the corresponding Python builtin scalar type, or
coercible to that Python scalar type.
dtype : str
Dtype of result. Must be specified.

Returns
-------
Column
"""
...

def __len__(self) -> int:
"""
Return the number of rows.
Expand Down