| 472 | return len(self.data) |
| 473 | |
| 474 | def sum(self, axis=None, dtype=None, out=None): |
| 475 | assert out is None and dtype is None, "`out` is just for compatible with numpy's aggregating function" |
| 476 | # FIXME: weird logic and not general |
| 477 | if axis is None: |
| 478 | return np.nansum(self.data) |
| 479 | elif axis == 0: |
| 480 | tmp_data = np.nansum(self.data, axis=0) |
| 481 | return SingleData(tmp_data, self.columns) |
| 482 | elif axis == 1: |
| 483 | tmp_data = np.nansum(self.data, axis=1) |
| 484 | return SingleData(tmp_data, self.index) |
| 485 | else: |
| 486 | raise ValueError(f"axis must be None, 0 or 1") |
| 487 | |
| 488 | def mean(self, axis=None, dtype=None, out=None): |
| 489 | assert out is None and dtype is None, "`out` is just for compatible with numpy's aggregating function" |