Skip to content

Prefer str | list[str] over Sequence[str] #240

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions spec/API_specification/dataframe_api/dataframe_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ def shape(self) -> tuple[int, int]:
Return number of rows and number of columns.
"""

def groupby(self, keys: Sequence[str], /) -> GroupBy:
def groupby(self, keys: str | list[str], /) -> GroupBy:
"""
Group the DataFrame by the given columns.

Parameters
----------
keys : Sequence[str]
keys : str | list[str]

Returns
-------
Expand Down Expand Up @@ -247,7 +247,7 @@ def get_column_names(self) -> Sequence[str]:

def sort(
self,
keys: Sequence[str] | None = None,
keys: str | list[str] | None = None,
*,
ascending: Sequence[bool] | bool = True,
nulls_position: Literal['first', 'last'] = 'last',
Expand All @@ -260,7 +260,7 @@ def sort(

Parameters
----------
keys : Sequence[str] | None
keys : str | list[str], optional
Names of columns to sort by.
If `None`, sort by all columns.
ascending : Sequence[bool] or bool
Expand Down Expand Up @@ -288,7 +288,7 @@ def sort(

def sorted_indices(
self,
keys: Sequence[str] | None = None,
keys: str | list[str] | None = None,
*,
ascending: Sequence[bool] | bool = True,
nulls_position: Literal['first', 'last'] = 'last',
Expand All @@ -300,7 +300,7 @@ def sorted_indices(

Parameters
----------
keys : Sequence[str] | None
keys : str | list[str], optional
Names of columns to sort by.
If `None`, sort by all columns.
ascending : Sequence[bool] or bool
Expand Down Expand Up @@ -793,10 +793,16 @@ def is_nan(self) -> DataFrame:
"""
...

def unique_indices(self, keys: Sequence[str], *, skip_nulls: bool = True) -> Column[int]:
def unique_indices(self, keys: str | list[str] | None = None, *, skip_nulls: bool = True) -> Column[int]:
"""
Return indices corresponding to unique values across selected columns.

Parameters
----------
keys : str | list[str], optional
Column names to consider when finding unique values.
If `None`, all columns are considered.

Returns
-------
Column[int]
Expand Down