Skip to content

Commit 97d4dfc

Browse files
authored
improve str ergonomics (#240)
1 parent 3ea3a43 commit 97d4dfc

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
-------
@@ -255,7 +255,7 @@ def get_column_names(self) -> list[str]:
255255

256256
def sort(
257257
self,
258-
keys: Sequence[str] | None = None,
258+
keys: str | list[str] | None = None,
259259
*,
260260
ascending: Sequence[bool] | bool = True,
261261
nulls_position: Literal['first', 'last'] = 'last',
@@ -268,7 +268,7 @@ def sort(
268268
269269
Parameters
270270
----------
271-
keys : Sequence[str] | None
271+
keys : str | list[str], optional
272272
Names of columns to sort by.
273273
If `None`, sort by all columns.
274274
ascending : Sequence[bool] or bool
@@ -296,7 +296,7 @@ def sort(
296296

297297
def sorted_indices(
298298
self,
299-
keys: Sequence[str] | None = None,
299+
keys: str | list[str] | None = None,
300300
*,
301301
ascending: Sequence[bool] | bool = True,
302302
nulls_position: Literal['first', 'last'] = 'last',
@@ -308,7 +308,7 @@ def sorted_indices(
308308
309309
Parameters
310310
----------
311-
keys : Sequence[str] | None
311+
keys : str | list[str], optional
312312
Names of columns to sort by.
313313
If `None`, sort by all columns.
314314
ascending : Sequence[bool] or bool
@@ -801,10 +801,16 @@ def is_nan(self) -> DataFrame:
801801
"""
802802
...
803803

804-
def unique_indices(self, keys: Sequence[str], *, skip_nulls: bool = True) -> Column[int]:
804+
def unique_indices(self, keys: str | list[str] | None = None, *, skip_nulls: bool = True) -> Column[int]:
805805
"""
806806
Return indices corresponding to unique values across selected columns.
807807
808+
Parameters
809+
----------
810+
keys : str | list[str], optional
811+
Column names to consider when finding unique values.
812+
If `None`, all columns are considered.
813+
808814
Returns
809815
-------
810816
Column[int]

0 commit comments

Comments
 (0)