| 598 | groupby_aggregate = M.sum |
| 599 | |
| 600 | def _simplify_down(self): |
| 601 | if ( |
| 602 | self._slice is not None |
| 603 | and not isinstance(self._slice, list) |
| 604 | or self.frame.ndim == 1 |
| 605 | ): |
| 606 | # Scalar slices influence the result and are allowed, i.e., the name of |
| 607 | # the series is different |
| 608 | return |
| 609 | |
| 610 | # We can remove every column since pandas reduces to a Series anyway |
| 611 | by_columns = self._by_columns |
| 612 | by_columns = [c for c in by_columns if c in self.frame.columns] |
| 613 | if set(by_columns) == set(self.frame.columns): |
| 614 | return |
| 615 | |
| 616 | slice_idx = self._parameters.index("_slice") |
| 617 | ops = [op if i != slice_idx else None for i, op in enumerate(self.operands)] |
| 618 | return type(self)(self.frame[by_columns], *ops[1:]) |
| 619 | |
| 620 | |
| 621 | class IdxMin(SingleAggregation): |