diff --git a/spec/API_specification/dataframe_api/__init__.py b/spec/API_specification/dataframe_api/__init__.py index 5d9d3400..06aab09c 100644 --- a/spec/API_specification/dataframe_api/__init__.py +++ b/spec/API_specification/dataframe_api/__init__.py @@ -4,7 +4,7 @@ """ from __future__ import annotations -from typing import Mapping, Sequence, Any, Literal, TYPE_CHECKING +from typing import Dict, Sequence, Any, TYPE_CHECKING from .column_object import * from .dataframe_object import DataFrame @@ -137,7 +137,7 @@ def column_from_1d_array(array: Any, *, dtype: DType, name: str = '') -> Column: """ ... -def dataframe_from_2d_array(array: Any, *, names: Sequence[str], dtypes: Mapping[str, Any]) -> DataFrame: +def dataframe_from_2d_array(array: Any, *, schema: Dict[str, DType]) -> DataFrame: """ Construct DataFrame from 2D array. @@ -151,10 +151,9 @@ def dataframe_from_2d_array(array: Any, *, names: Sequence[str], dtypes: Mapping ---------- array : array array-API compliant 2D array - names : Sequence[str] - Names to give columns. Must be the same length as ``array.shape[1]``. dtypes : Mapping[str, DType] Dtype of each column. Must be the same length as ``array.shape[1]``. + Keys determine column names. Returns ------- @@ -204,8 +203,8 @@ def is_null(value: object, /) -> bool: bool True if the input is a `null` object from the same library which implements the dataframe API standard, False otherwise. - """ + ... def is_dtype(dtype: DType, kind: str | tuple[str, ...]) -> bool: """ @@ -237,6 +236,7 @@ def is_dtype(dtype: DType, kind: str | tuple[str, ...]) -> bool: ------- bool """ + ... def date(year: int, month: int, day: int) -> Scalar: """ diff --git a/spec/API_specification/dataframe_api/column_object.py b/spec/API_specification/dataframe_api/column_object.py index 638381eb..0bccf2d0 100644 --- a/spec/API_specification/dataframe_api/column_object.py +++ b/spec/API_specification/dataframe_api/column_object.py @@ -47,6 +47,7 @@ def column(self) -> Any: @property def name(self) -> str: """Return name of column.""" + ... def __len__(self) -> int: """ diff --git a/spec/API_specification/dataframe_api/typing.py b/spec/API_specification/dataframe_api/typing.py index 1532b203..cf00591c 100644 --- a/spec/API_specification/dataframe_api/typing.py +++ b/spec/API_specification/dataframe_api/typing.py @@ -121,7 +121,7 @@ def column_from_sequence( self, sequence: Sequence[Any], *, - dtype: Any, + dtype: DType, name: str = "", ) -> Column: ... @@ -130,7 +130,7 @@ def dataframe_from_columns(self, *columns: Column) -> DataFrame: ... def column_from_1d_array( - self, array: Any, *, dtype: Any, name: str = "" + self, array: Any, *, dtype: DType, name: str = "" ) -> Column: ... @@ -139,14 +139,14 @@ def dataframe_from_2d_array( array: Any, *, names: Sequence[str], - dtypes: Mapping[str, Any], + schema: Mapping[str, DType], ) -> DataFrame: ... def is_null(self, value: object, /) -> bool: ... - def is_dtype(self, dtype: Any, kind: str | tuple[str, ...]) -> bool: + def is_dtype(self, dtype: DType, kind: str | tuple[str, ...]) -> bool: ... def date(self, year: int, month: int, day: int) -> Scalar: