Skip to content

Commit c4ab5b4

Browse files
authored
remove names from dataframe_from_2d_array (#302)
* remove `names` from dataframe_from_2d_array * Mapping -> Dict * rename to schema
1 parent a395e97 commit c4ab5b4

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

spec/API_specification/dataframe_api/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"""
55
from __future__ import annotations
66

7-
from typing import Mapping, Sequence, Any, Literal, TYPE_CHECKING
7+
from typing import Dict, Sequence, Any, TYPE_CHECKING
88

99
from .column_object import *
1010
from .dataframe_object import DataFrame
@@ -137,7 +137,7 @@ def column_from_1d_array(array: Any, *, dtype: DType, name: str = '') -> Column:
137137
"""
138138
...
139139

140-
def dataframe_from_2d_array(array: Any, *, names: Sequence[str], dtypes: Mapping[str, Any]) -> DataFrame:
140+
def dataframe_from_2d_array(array: Any, *, schema: Dict[str, DType]) -> DataFrame:
141141
"""
142142
Construct DataFrame from 2D array.
143143
@@ -151,10 +151,9 @@ def dataframe_from_2d_array(array: Any, *, names: Sequence[str], dtypes: Mapping
151151
----------
152152
array : array
153153
array-API compliant 2D array
154-
names : Sequence[str]
155-
Names to give columns. Must be the same length as ``array.shape[1]``.
156154
dtypes : Mapping[str, DType]
157155
Dtype of each column. Must be the same length as ``array.shape[1]``.
156+
Keys determine column names.
158157
159158
Returns
160159
-------
@@ -204,8 +203,8 @@ def is_null(value: object, /) -> bool:
204203
bool
205204
True if the input is a `null` object from the same library which
206205
implements the dataframe API standard, False otherwise.
207-
208206
"""
207+
...
209208

210209
def is_dtype(dtype: DType, kind: str | tuple[str, ...]) -> bool:
211210
"""
@@ -237,6 +236,7 @@ def is_dtype(dtype: DType, kind: str | tuple[str, ...]) -> bool:
237236
-------
238237
bool
239238
"""
239+
...
240240

241241
def date(year: int, month: int, day: int) -> Scalar:
242242
"""

spec/API_specification/dataframe_api/column_object.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ def column(self) -> Any:
4747
@property
4848
def name(self) -> str:
4949
"""Return name of column."""
50+
...
5051

5152
def __len__(self) -> int:
5253
"""

spec/API_specification/dataframe_api/typing.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def column_from_sequence(
121121
self,
122122
sequence: Sequence[Any],
123123
*,
124-
dtype: Any,
124+
dtype: DType,
125125
name: str = "",
126126
) -> Column:
127127
...
@@ -130,7 +130,7 @@ def dataframe_from_columns(self, *columns: Column) -> DataFrame:
130130
...
131131

132132
def column_from_1d_array(
133-
self, array: Any, *, dtype: Any, name: str = ""
133+
self, array: Any, *, dtype: DType, name: str = ""
134134
) -> Column:
135135
...
136136

@@ -139,14 +139,14 @@ def dataframe_from_2d_array(
139139
array: Any,
140140
*,
141141
names: Sequence[str],
142-
dtypes: Mapping[str, Any],
142+
schema: Mapping[str, DType],
143143
) -> DataFrame:
144144
...
145145

146146
def is_null(self, value: object, /) -> bool:
147147
...
148148

149-
def is_dtype(self, dtype: Any, kind: str | tuple[str, ...]) -> bool:
149+
def is_dtype(self, dtype: DType, kind: str | tuple[str, ...]) -> bool:
150150
...
151151

152152
def date(self, year: int, month: int, day: int) -> Scalar:

0 commit comments

Comments
 (0)