Repository: modin-project/modin

Issue:
REFACTOR: Fix and refactor `resample` methods
We need to port fixes for resample.{sum,prod,size} and route a few additional methods differently. Unfortunately, the commits do not include test cases, so we will need to either comb through our internal JIRA or triage the failure cases manually.

- https://github.com/ponder-org/modin-public/commit/bd77b4140b029e38f7160546c663ca861f1dceee
- https://github.com/ponder-org/modin-public/commit/b6dc5c80e1a90b66876b15276ee9ea7433655872
- https://github.com/ponder-org/modin-public/commit/32a8db9e2238bb24c08c1416e50e2d7bba2aa842 <- need to figure out why this is marked no upstream
- https://github.com/ponder-org/modin-public/commit/b3fde395db21ee8d6092c8c3ade8ac9304fb814c
- https://github.com/ponder-org/modin-public/commit/ba7aa6d118ac85f0659daa8e768b270900a4dc82


Discussion:

Resolving patch:
diff --git a/modin/pandas/resample.py b/modin/pandas/resample.py
--- a/modin/pandas/resample.py
+++ b/modin/pandas/resample.py
@@ -139,8 +139,11 @@ def indices(self):
         )
 
     def get_group(self, name, obj=None):
-        group = self.__groups.get_group(name)
-        return group if self.axis == 0 else group.T
+        return self._dataframe.__constructor__(
+            query_compiler=self._query_compiler.resample_get_group(
+                self.resample_kwargs, name, obj
+            )
+        )
 
     def apply(self, func, *args, **kwargs):
         func = cast_function_modin2pandas(func)
@@ -206,32 +209,16 @@ def pipe(self, func, *args, **kwargs):
         )
 
     def ffill(self, limit=None):
-        return self._dataframe.__constructor__(
-            query_compiler=self._query_compiler.resample_ffill(
-                self.resample_kwargs, limit
-            )
-        )
+        return self.fillna(method="ffill", limit=limit)
 
     def backfill(self, limit=None):
-        return self._dataframe.__constructor__(
-            query_compiler=self._query_compiler.resample_backfill(
-                self.resample_kwargs, limit
-            )
-        )
+        return self.bfill(limit)
 
     def bfill(self, limit=None):
-        return self._dataframe.__constructor__(
-            query_compiler=self._query_compiler.resample_bfill(
-                self.resample_kwargs, limit
-            )
-        )
+        return self.fillna(method="bfill", limit=limit)
 
     def pad(self, limit=None):
-        return self._dataframe.__constructor__(
-            query_compiler=self._query_compiler.resample_pad(
-                self.resample_kwargs, limit
-            )
-        )
+        return self.fillna(method="ffill", limit=limit)
 
     def nearest(self, limit=None):
         return self._dataframe.__constructor__(
@@ -366,15 +353,22 @@ def ohlc(self, *args, **kwargs):
             )
 
     def prod(self, min_count=0, *args, **kwargs):
-        prod = self.__groups.prod(min_count=min_count, *args, **kwargs)
-        return prod if self.axis == 0 else prod.T
+        return self._dataframe.__constructor__(
+            query_compiler=self._query_compiler.resample_prod(
+                self.resample_kwargs, min_count=min_count, *args, **kwargs
+            )
+        )
 
     def size(self):
         from .series import Series
 
-        return Series(
+        output_series = Series(
             query_compiler=self._query_compiler.resample_size(self.resample_kwargs)
         )
+        if not isinstance(self._dataframe, Series):
+            # If input is a DataFrame, rename output Series to None
+            return output_series.rename(None)
+        return output_series
 
     def sem(self, *args, **kwargs):
         return self._dataframe.__constructor__(
@@ -393,8 +387,11 @@ def std(self, ddof=1, *args, **kwargs):
         )
 
     def sum(self, min_count=0, *args, **kwargs):
-        _sum = self.__groups.sum(min_count=min_count, *args, **kwargs)
-        return _sum if self.axis == 0 else _sum.T
+        return self._dataframe.__constructor__(
+            query_compiler=self._query_compiler.resample_sum(
+                self.resample_kwargs, min_count=min_count, *args, **kwargs
+            )
+        )
 
     def var(self, ddof=1, *args, **kwargs):
         return self._dataframe.__constructor__(


Test patch:
diff --git a/modin/pandas/test/test_series.py b/modin/pandas/test/test_series.py
--- a/modin/pandas/test/test_series.py
+++ b/modin/pandas/test/test_series.py
@@ -2303,7 +2303,6 @@ def test_loc(data):
     data = np.arange(100)
     modin_series = pd.Series(data, index=index).sort_index()
     pandas_series = pandas.Series(data, index=index).sort_index()
-
     modin_result = modin_series.loc[
         (slice(None), 1),
     ]  # fmt: skip