Skip to content

Commit 686a89a

Browse files
committed
add to namespace, type return as scalar
1 parent eb03b45 commit 686a89a

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

spec/API_specification/dataframe_api/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from .dtypes import *
1212

1313
if TYPE_CHECKING:
14-
from .typing import DType
14+
from .typing import DType, Scalar
1515

1616
__all__ = [
1717
"Bool",
@@ -243,7 +243,7 @@ def is_dtype(dtype: DType, kind: str | tuple[str, ...]) -> bool:
243243
bool
244244
"""
245245

246-
def date(year: int, month: int, day: int) -> Any:
246+
def date(year: int, month: int, day: int) -> Scalar:
247247
"""
248248
Create date object which can be used for filtering.
249249
@@ -253,7 +253,7 @@ def date(year: int, month: int, day: int) -> Any:
253253
>>> namespace = df.__dataframe_namespace__()
254254
>>> mask = (
255255
... (df.get_column_by_name('date') >= namespace.date(2020, 1, 1))
256-
... (df.get_column_by_name('date') < namespace.date(2021, 1, 1))
256+
... & (df.get_column_by_name('date') < namespace.date(2021, 1, 1))
257257
... )
258258
>>> df.filter(mask)
259259
"""

spec/API_specification/dataframe_api/typing.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,9 @@ def is_null(value: object, /) -> bool:
148148
def is_dtype(dtype: Any, kind: str | tuple[str, ...]) -> bool:
149149
...
150150

151+
@staticmethod
152+
def date(year: int, month: int, day: int) -> Scalar:
153+
...
151154

152155
class SupportsDataFrameAPI(Protocol):
153156
def __dataframe_consortium_standard__(

0 commit comments

Comments
 (0)