Skip to content

Commit a5abfd6

Browse files
committed
improve str ergonomics
1 parent 77bc66b commit a5abfd6

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

spec/API_specification/dataframe_api/dataframe_object.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ def shape(self) -> tuple[int, int]:
6565
Return number of rows and number of columns.
6666
"""
6767

68-
def groupby(self, keys: Sequence[str], /) -> GroupBy:
68+
def groupby(self, keys: str | list[str], /) -> GroupBy:
6969
"""
7070
Group the DataFrame by the given columns.
7171
7272
Parameters
7373
----------
74-
keys : Sequence[str]
74+
keys : str | list[str]
7575
7676
Returns
7777
-------
@@ -247,7 +247,7 @@ def get_column_names(self) -> Sequence[str]:
247247

248248
def sort(
249249
self,
250-
keys: Sequence[str] | None = None,
250+
keys: str | list[str] | None = None,
251251
*,
252252
ascending: Sequence[bool] | bool = True,
253253
nulls_position: Literal['first', 'last'] = 'last',
@@ -260,7 +260,7 @@ def sort(
260260
261261
Parameters
262262
----------
263-
keys : Sequence[str] | None
263+
keys : str | list[str], optional
264264
Names of columns to sort by.
265265
If `None`, sort by all columns.
266266
ascending : Sequence[bool] or bool
@@ -288,7 +288,7 @@ def sort(
288288

289289
def sorted_indices(
290290
self,
291-
keys: Sequence[str] | None = None,
291+
keys: str | list[str] | None = None,
292292
*,
293293
ascending: Sequence[bool] | bool = True,
294294
nulls_position: Literal['first', 'last'] = 'last',
@@ -300,7 +300,7 @@ def sorted_indices(
300300
301301
Parameters
302302
----------
303-
keys : Sequence[str] | None
303+
keys : str | list[str], optional
304304
Names of columns to sort by.
305305
If `None`, sort by all columns.
306306
ascending : Sequence[bool] or bool
@@ -793,10 +793,16 @@ def is_nan(self) -> DataFrame:
793793
"""
794794
...
795795

796-
def unique_indices(self, keys: Sequence[str], *, skip_nulls: bool = True) -> Column[int]:
796+
def unique_indices(self, keys: str | list[str] | None = None, *, skip_nulls: bool = True) -> Column[int]:
797797
"""
798798
Return indices corresponding to unique values across selected columns.
799799
800+
Parameters
801+
----------
802+
keys : str | list[str], optional
803+
Column names to consider when finding unique values.
804+
If `None`, all columns are considered.
805+
800806
Returns
801807
-------
802808
Column[int]

0 commit comments

Comments
 (0)