def aggregate(self, func: Union[(List[str], Dict[(Name, List[str])])]) -> 'DataFrame':
    'Aggregate using one or more operations over the specified axis.\n\n        Parameters\n        ----------\n        func : dict or a list\n             a dict mapping from column name (string) to\n             aggregate functions (list of strings).\n             If a list is given, the aggregation is performed against\n             all columns.\n\n        Returns\n        -------\n        DataFrame\n\n        Notes\n        -----\n        `agg` is an alias for `aggregate`. Use the alias.\n\n        See Also\n        --------\n        DataFrame.apply : Invoke function on DataFrame.\n        DataFrame.transform : Only perform transforming type operations.\n        DataFrame.groupby : Perform operations over groups.\n        Series.aggregate : The equivalent function for Series.\n\n        Examples\n        --------\n        >>> df = ps.DataFrame([[1, 2, 3],\n        ...                    [4, 5, 6],\n        ...                    [7, 8, 9],\n        ...                    [np.nan, np.nan, np.nan]],\n        ...                   columns=[\'A\', \'B\', \'C\'])\n\n        >>> df\n             A    B    C\n        0  1.0  2.0  3.0\n        1  4.0  5.0  6.0\n        2  7.0  8.0  9.0\n        3  NaN  NaN  NaN\n\n        Aggregate these functions over the rows.\n\n        >>> df.agg([\'sum\', \'min\'])[[\'A\', \'B\', \'C\']].sort_index()\n                A     B     C\n        min   1.0   2.0   3.0\n        sum  12.0  15.0  18.0\n\n        Different aggregations per column.\n\n        >>> df.agg({\'A\' : [\'sum\', \'min\'], \'B\' : [\'min\', \'max\']})[[\'A\', \'B\']].sort_index()\n                A    B\n        max   NaN  8.0\n        min   1.0  2.0\n        sum  12.0  NaN\n\n        For multi-index columns:\n\n        >>> df.columns = pd.MultiIndex.from_tuples([("X", "A"), ("X", "B"), ("Y", "C")])\n        >>> df.agg([\'sum\', \'min\'])[[("X", "A"), ("X", "B"), ("Y", "C")]].sort_index()\n                X           Y\n                A     B     C\n        min   1.0   2.0   3.0\n        sum  12.0  15.0  18.0\n\n        >>> aggregated = df.agg({("X", "A") : [\'sum\', \'min\'], ("X", "B") : [\'min\', \'max\']})\n        >>> aggregated[[("X", "A"), ("X", "B")]].sort_index()  # doctest: +NORMALIZE_WHITESPACE\n                X\n                A    B\n        max   NaN  8.0\n        min   1.0  2.0\n        sum  12.0  NaN\n        '
    from pyspark.pandas.groupby import GroupBy
    if isinstance(func, list):
        if all((isinstance(f, str) for f in func)):
            func = dict([(column, func) for column in self.columns])
        else:
            raise ValueError('If the given function is a list, it should only contains function names as strings.')
    if ((not isinstance(func, dict)) or (not all(((is_name_like_value(key) and (isinstance(value, str) or (isinstance(value, list) and all((isinstance(v, str) for v in value))))) for (key, value) in func.items())))):
        raise ValueError('aggs must be a dict mapping from column name to aggregate functions (string or list of strings).')
    with option_context('compute.default_index_type', 'distributed'):
        psdf: DataFrame = DataFrame(GroupBy._spark_groupby(self, func))
        return psdf.stack().droplevel(0)[list(func.keys())]
Aggregate using one or more operations over the specified axis.

Parameters
----------
func : dict or a list
     a dict mapping from column name (string) to
     aggregate functions (list of strings).
     If a list is given, the aggregation is performed against
     all columns.

Returns
-------
DataFrame

Notes
-----
`agg` is an alias for `aggregate`. Use the alias.

See Also
--------
DataFrame.apply : Invoke function on DataFrame.
DataFrame.transform : Only perform transforming type operations.
DataFrame.groupby : Perform operations over groups.
Series.aggregate : The equivalent function for Series.

Examples
--------
>>> df = ps.DataFrame([[1, 2, 3],
...                    [4, 5, 6],
...                    [7, 8, 9],
...                    [np.nan, np.nan, np.nan]],
...                   columns=['A', 'B', 'C'])

>>> df
     A    B    C
0  1.0  2.0  3.0
1  4.0  5.0  6.0
2  7.0  8.0  9.0
3  NaN  NaN  NaN

Aggregate these functions over the rows.

>>> df.agg(['sum', 'min'])[['A', 'B', 'C']].sort_index()
        A     B     C
min   1.0   2.0   3.0
sum  12.0  15.0  18.0

Different aggregations per column.

>>> df.agg({'A' : ['sum', 'min'], 'B' : ['min', 'max']})[['A', 'B']].sort_index()
        A    B
max   NaN  8.0
min   1.0  2.0
sum  12.0  NaN

For multi-index columns:

>>> df.columns = pd.MultiIndex.from_tuples([("X", "A"), ("X", "B"), ("Y", "C")])
>>> df.agg(['sum', 'min'])[[("X", "A"), ("X", "B"), ("Y", "C")]].sort_index()
        X           Y
        A     B     C
min   1.0   2.0   3.0
sum  12.0  15.0  18.0

>>> aggregated = df.agg({("X", "A") : ['sum', 'min'], ("X", "B") : ['min', 'max']})
>>> aggregated[[("X", "A"), ("X", "B")]].sort_index()  # doctest: +NORMALIZE_WHITESPACE
        X
        A    B
max   NaN  8.0
min   1.0  2.0
sum  12.0  NaN
def aggregate(self, func: Union[(List[str], Dict[(Name, List[str])])]) -> 'DataFrame':
    'Aggregate using one or more operations over the specified axis.\n\n        Parameters\n        ----------\n        func : dict or a list\n             a dict mapping from column name (string) to\n             aggregate functions (list of strings).\n             If a list is given, the aggregation is performed against\n             all columns.\n\n        Returns\n        -------\n        DataFrame\n\n        Notes\n        -----\n        `agg` is an alias for `aggregate`. Use the alias.\n\n        See Also\n        --------\n        DataFrame.apply : Invoke function on DataFrame.\n        DataFrame.transform : Only perform transforming type operations.\n        DataFrame.groupby : Perform operations over groups.\n        Series.aggregate : The equivalent function for Series.\n\n        Examples\n        --------\n        >>> df = ps.DataFrame([[1, 2, 3],\n        ...                    [4, 5, 6],\n        ...                    [7, 8, 9],\n        ...                    [np.nan, np.nan, np.nan]],\n        ...                   columns=[\'A\', \'B\', \'C\'])\n\n        >>> df\n             A    B    C\n        0  1.0  2.0  3.0\n        1  4.0  5.0  6.0\n        2  7.0  8.0  9.0\n        3  NaN  NaN  NaN\n\n        Aggregate these functions over the rows.\n\n        >>> df.agg([\'sum\', \'min\'])[[\'A\', \'B\', \'C\']].sort_index()\n                A     B     C\n        min   1.0   2.0   3.0\n        sum  12.0  15.0  18.0\n\n        Different aggregations per column.\n\n        >>> df.agg({\'A\' : [\'sum\', \'min\'], \'B\' : [\'min\', \'max\']})[[\'A\', \'B\']].sort_index()\n                A    B\n        max   NaN  8.0\n        min   1.0  2.0\n        sum  12.0  NaN\n\n        For multi-index columns:\n\n        >>> df.columns = pd.MultiIndex.from_tuples([("X", "A"), ("X", "B"), ("Y", "C")])\n        >>> df.agg([\'sum\', \'min\'])[[("X", "A"), ("X", "B"), ("Y", "C")]].sort_index()\n                X           Y\n                A     B     C\n        min   1.0   2.0   3.0\n        sum  12.0  15.0  18.0\n\n        >>> aggregated = df.agg({("X", "A") : [\'sum\', \'min\'], ("X", "B") : [\'min\', \'max\']})\n        >>> aggregated[[("X", "A"), ("X", "B")]].sort_index()  # doctest: +NORMALIZE_WHITESPACE\n                X\n                A    B\n        max   NaN  8.0\n        min   1.0  2.0\n        sum  12.0  NaN\n        '
    from pyspark.pandas.groupby import GroupBy
    if isinstance(func, list):
        if all((isinstance(f, str) for f in func)):
            func = dict([(column, func) for column in self.columns])
        else:
            raise ValueError('If the given function is a list, it should only contains function names as strings.')
    if ((not isinstance(func, dict)) or (not all(((is_name_like_value(key) and (isinstance(value, str) or (isinstance(value, list) and all((isinstance(v, str) for v in value))))) for (key, value) in func.items())))):
        raise ValueError('aggs must be a dict mapping from column name to aggregate functions (string or list of strings).')
    with option_context('compute.default_index_type', 'distributed'):
        psdf: DataFrame = DataFrame(GroupBy._spark_groupby(self, func))
        return psdf.stack().droplevel(0)[list(func.keys())]