Repository: modin-project/modin

Issue:
Groupby agg needs an extra argument unlike pandas
### System information

- OS Platform and Distribution: Linux Ubuntu 16.04
- Modin version : 0.7.3
- Python version: 3.6.7
- Code we can use to reproduce:

```
# Create a dummy.csv file with the following content
a,b,c
1,2,3
4,5,6
1,2,3


if __name__ == "__main__":
    import pandas as pd

    df = pd.read_csv("dummy.csv", sep=",")
    df_agg = df.groupby(["a","b"]).agg(
        Max=('c', np.max),
        Sum=('c', np.sum),
        Uni=("c", pd.Series.nunique)
    ).reset_index()

    print(df_agg)

    import modin.pandas as mpd
    df = mpd.read_csv("dummy.csv", sep=",")
    df_agg2 = df.groupby(["a","b"]).agg(
        Max=('c', np.max),
        Sum=('c', np.sum),
        target_col=('c', mpd.Series.nunique)
    ).reset_index()

```

### Describe the problem

Modin throws an error: TypeError: agg() missing 1 required positional argument: 'arg'



Discussion:
Hi @isilopekel thanks for the report!

I will have to dig into this. Our API is matching pandas, but I need to see how they are handling this case internally because it is the python interpreter throwing the error when `agg` is called.

Resolving patch:
diff --git a/modin/pandas/groupby.py b/modin/pandas/groupby.py
--- a/modin/pandas/groupby.py
+++ b/modin/pandas/groupby.py
@@ -338,20 +338,22 @@ def prod(self, **kwargs):
     def std(self, ddof=1, *args, **kwargs):
         return self._apply_agg_function(lambda df: df.std(ddof, *args, **kwargs))
 
-    def aggregate(self, arg, *args, **kwargs):
+    def aggregate(self, func=None, *args, **kwargs):
         if self._axis != 0:
             # This is not implemented in pandas,
             # so we throw a different message
             raise NotImplementedError("axis other than 0 is not supported")
 
-        if is_list_like(arg):
+        if func is None or is_list_like(func):
             return self._default_to_pandas(
-                lambda df: df.aggregate(arg, *args, **kwargs)
+                lambda df: df.aggregate(func, *args, **kwargs)
             )
         return self._apply_agg_function(
-            lambda df: df.aggregate(arg, *args, **kwargs), drop=self._as_index
+            lambda df: df.aggregate(func, *args, **kwargs), drop=self._as_index
         )
 
+    agg = aggregate
+
     def last(self, **kwargs):
         return self._default_to_pandas(lambda df: df.last(**kwargs))
 
@@ -491,9 +493,6 @@ def cumprod(self, axis=0, *args, **kwargs):
     def __iter__(self):
         return self._iter.__iter__()
 
-    def agg(self, arg, *args, **kwargs):
-        return self.aggregate(arg, *args, **kwargs)
-
     def cov(self):
         return self._default_to_pandas(lambda df: df.cov())
 


Test patch:
diff --git a/modin/pandas/test/test_groupby.py b/modin/pandas/test/test_groupby.py
--- a/modin/pandas/test/test_groupby.py
+++ b/modin/pandas/test/test_groupby.py
@@ -1052,3 +1052,24 @@ def test_groupby_multiindex():
 
     by = ["one", "two"]
     df_equals(modin_df.groupby(by=by).count(), pandas_df.groupby(by=by).count())
+
+
+def test_agg_func_None_rename():
+    pandas_df = pandas.DataFrame(
+        {
+            "col1": np.random.randint(0, 100, size=1000),
+            "col2": np.random.randint(0, 100, size=1000),
+            "col3": np.random.randint(0, 100, size=1000),
+            "col4": np.random.randint(0, 100, size=1000),
+        },
+        index=["row{}".format(i) for i in range(1000)],
+    )
+    modin_df = from_pandas(pandas_df)
+
+    modin_result = modin_df.groupby(["col1", "col2"]).agg(
+        max=("col3", np.max), min=("col3", np.min)
+    )
+    pandas_result = pandas_df.groupby(["col1", "col2"]).agg(
+        max=("col3", np.max), min=("col3", np.min)
+    )
+    df_equals(modin_result, pandas_result)