From cb41c6a895a69159bfd1640ca67dc86af8420cd8 Mon Sep 17 00:00:00 2001 From: Naren Krishna <92325366+naren-ponder@users.noreply.github.com> Date: Thu, 2 Feb 2023 09:16:58 -0800 Subject: [PATCH] Fix resample sum, prod, size (#56) Signed-off-by: Naren Krishna --- modin/pandas/resample.py | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/modin/pandas/resample.py b/modin/pandas/resample.py index fc1a67e3304..30a0f58a651 100644 --- a/modin/pandas/resample.py +++ b/modin/pandas/resample.py @@ -383,18 +383,18 @@ def ohlc(self, _method="ohlc", *args, **kwargs): ) ) - def prod(self, _method="prod", min_count=0, *args, **kwargs): - if self.resample_kwargs["axis"] == 0: - result = self.__groups.prod(min_count=min_count, *args, **kwargs) - else: - result = self.__groups.prod(min_count=min_count, *args, **kwargs).T - return result - - def size(self): - from .series import Series + def prod(self, _method="prod", *args, **kwargs): + return self._dataframe.__constructor__( + query_compiler=self._query_compiler.resample_prod( + self.resample_kwargs, *args, **kwargs + ) + ) - return Series( - query_compiler=self._query_compiler.resample_size(self.resample_kwargs) + def size(self, _method="size"): + return self._dataframe.__constructor__( + query_compiler=self._query_compiler.resample_size( + self.resample_kwargs, None, None + ) ) def sem(self, _method="sem", *args, **kwargs): @@ -414,12 +414,12 @@ def std(self, ddof=1, *args, **kwargs): ) ) - def sum(self, _method="sum", min_count=0, *args, **kwargs): - if self.resample_kwargs["axis"] == 0: - result = self.__groups.sum(min_count=min_count, *args, **kwargs) - else: - result = self.__groups.sum(min_count=min_count, *args, **kwargs).T - return result + def sum(self, _method="sum", *args, **kwargs): + return self._dataframe.__constructor__( + query_compiler=self._query_compiler.resample_sum( + self.resample_kwargs, *args, **kwargs + ) + ) def var(self, ddof=1, *args, **kwargs): return self._dataframe.__constructor__(