Skip to content

Commit

Permalink
perf(python): speed up in series 10x (pola-rs#9794)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonashaag authored Jul 11, 2023
1 parent 68f3f55 commit dbe7b51
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions py-polars/polars/series/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,13 @@ def __copy__(self) -> Self:
def __deepcopy__(self, memo: None = None) -> Self:
return self.clone()

def __contains__(self, item: Any) -> bool:
# TODO! optimize via `is_in` and `SORTED` flags
try:
return (self == item).any()
except ValueError:
return False

def __iter__(self) -> Generator[Any, None, None]:
if self.dtype == List:
# TODO: either make a change and return py-native list data here, or find
Expand Down

0 comments on commit dbe7b51

Please sign in to comment.