(self, other)
| 437 | return new_collection, (self._expr,) |
| 438 | |
| 439 | def __getitem__(self, other): |
| 440 | if isinstance(other, FrameBase): |
| 441 | if not expr.are_co_aligned(self.expr, other.expr): |
| 442 | return new_collection(expr.FilterAlign(self, other)) |
| 443 | return new_collection(self.expr.__getitem__(other.expr)) |
| 444 | elif isinstance(other, slice): |
| 445 | from pandas.api.types import is_float_dtype |
| 446 | |
| 447 | is_integer_slice = any( |
| 448 | isinstance(i, Integral) for i in (other.start, other.step, other.stop) |
| 449 | ) |
| 450 | if ( |
| 451 | self.ndim == 2 |
| 452 | and is_integer_slice |
| 453 | and (not is_float_dtype(self.index.dtype) or PANDAS_GE_300) |
| 454 | ): |
| 455 | return self.iloc[other] |
| 456 | else: |
| 457 | return self.loc[other] |
| 458 | if isinstance(other, np.ndarray) or is_series_like(other): |
| 459 | other = list(other) |
| 460 | elif isinstance(other, list): |
| 461 | other = other.copy() |
| 462 | elif isinstance(other, np.generic): |
| 463 | other = other.item() |
| 464 | return new_collection(self.expr.__getitem__(other)) |
| 465 | |
| 466 | def __dask_tokenize__(self): |
| 467 | return type(self).__name__, self._expr._name |
nothing calls this directly
no test coverage detected