Skip to content

fix: series sort_index and sort_values now raises when axis!=0 #1294

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 2 commits into from
Jan 16, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions bigframes/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -1347,6 +1347,8 @@ def value_counts(
def sort_values(
self, *, axis=0, ascending=True, kind: str = "quicksort", na_position="last"
) -> Series:
if axis != 0 and axis != "index":
raise ValueError(f"No axis named {axis} for object type Series")
if na_position not in ["first", "last"]:
raise ValueError("Param na_position must be one of 'first' or 'last'")
block = self._block.order_by(
Expand All @@ -1361,6 +1363,8 @@ def sort_values(
@validations.requires_index
def sort_index(self, *, axis=0, ascending=True, na_position="last") -> Series:
# TODO(tbergeron): Support level parameter once multi-index introduced.
if axis != 0 and axis != "index":
raise ValueError(f"No axis named {axis} for object type Series")
if na_position not in ["first", "last"]:
raise ValueError("Param na_position must be one of 'first' or 'last'")
block = self._block
Expand Down
Loading