Skip to content

Commit

Permalink
restore sort to v1
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoGorelli committed Jan 15, 2025
1 parent 7b6738d commit d411345
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions narwhals/stable/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,22 @@ def gather_every(self: Self, n: int, offset: int = 0) -> Self:
lambda plx: self._to_compliant_expr(plx).gather_every(n=n, offset=offset)
)

def sort(self, *, descending: bool = False, nulls_last: bool = False) -> Self:
"""Sort this column. Place null values first.
Arguments:
descending: Sort in descending order.
nulls_last: Place null values last instead of first.
Returns:
A new expression.
"""
return self.__class__(
lambda plx: self._to_compliant_expr(plx).sort(
descending=descending, nulls_last=nulls_last
)
)


class Schema(NwSchema):
"""Ordered mapping of column names to their data type.
Expand Down

0 comments on commit d411345

Please sign in to comment.