8000 fix: series sort_index and sort_values now raises when axis!=0 by Genesis929 · Pull Request #1294 · googleapis/python-bigquery-dataframes · GitHub
[go: up one dir, main page]

Skip to content
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
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
0