def _reduce_for_stat_function(self, sfun: Callable[(['Series'], Column)], name: str, axis: Optional[Axis]=None, numeric_only: bool=True, **kwargs: Any) -> 'Series':
    "\n        Applies sfun to each column and returns a pd.Series where the number of rows equal the\n        number of columns.\n\n        Parameters\n        ----------\n        sfun : either an 1-arg function that takes a Column and returns a Column, or\n            a 2-arg function that takes a Column and its DataType and returns a Column.\n            axis: used only for sanity check because series only support index axis.\n        name : original pandas API name.\n        axis : axis to apply. 0 or 1, or 'index' or 'columns.\n        numeric_only : bool, default True\n            Include only float, int, boolean columns. False is not supported. This parameter\n            is mainly for pandas compatibility. Only 'DataFrame.count' uses this parameter\n            currently.\n        "
    from pyspark.pandas.series import Series, first_series
    axis = validate_axis(axis)
    if (axis == 0):
        min_count = kwargs.get('min_count', 0)
        exprs = [SF.lit(None).cast(StringType()).alias(SPARK_DEFAULT_INDEX_NAME)]
        new_column_labels = []
        for label in self._internal.column_labels:
            psser = self._psser_for(label)
            is_numeric_or_boolean = isinstance(psser.spark.data_type, (NumericType, BooleanType))
            keep_column = ((not numeric_only) or is_numeric_or_boolean)
            if keep_column:
                scol = sfun(psser)
                if (min_count > 0):
                    scol = F.when((Frame._count_expr(psser) >= min_count), scol)
                exprs.append(scol.alias(name_like_string(label)))
                new_column_labels.append(label)
        if (len(exprs) == 1):
            return Series([])
        sdf = self._internal.spark_frame.select(*exprs)
        with ps.option_context('compute.max_rows', 1):
            internal = InternalFrame(spark_frame=sdf, index_spark_columns=[scol_for(sdf, SPARK_DEFAULT_INDEX_NAME)], column_labels=new_column_labels, column_label_names=self._internal.column_label_names)
            return first_series(DataFrame(internal).transpose())
    else:
        limit = get_option('compute.shortcut_limit')
        pdf = self.head((limit + 1))._to_internal_pandas()
        pser = getattr(pdf, name)(axis=axis, numeric_only=numeric_only, **kwargs)
        if (len(pdf) <= limit):
            return Series(pser)

        @pandas_udf(returnType=as_spark_type(pser.dtype.type))
        def calculate_columns_axis(*cols: pd.Series) -> pd.Series:
            return getattr(pd.concat(cols, axis=1), name)(axis=axis, numeric_only=numeric_only, **kwargs)
        column_name = verify_temp_column_name(self._internal.spark_frame.select(self._internal.index_spark_columns), '__calculate_columns_axis__')
        sdf = self._internal.spark_frame.select((self._internal.index_spark_columns + [calculate_columns_axis(*self._internal.data_spark_columns).alias(column_name)]))
        internal = InternalFrame(spark_frame=sdf, index_spark_columns=[scol_for(sdf, col) for col in self._internal.index_spark_column_names], index_names=self._internal.index_names, index_fields=self._internal.index_fields)
        return first_series(DataFrame(internal)).rename(pser.name)
Applies sfun to each column and returns a pd.Series where the number of rows equal the
number of columns.

Parameters
----------
sfun : either an 1-arg function that takes a Column and returns a Column, or
    a 2-arg function that takes a Column and its DataType and returns a Column.
    axis: used only for sanity check because series only support index axis.
name : original pandas API name.
axis : axis to apply. 0 or 1, or 'index' or 'columns.
numeric_only : bool, default True
    Include only float, int, boolean columns. False is not supported. This parameter
    is mainly for pandas compatibility. Only 'DataFrame.count' uses this parameter
    currently.
def _reduce_for_stat_function(self, sfun: Callable[(['Series'], Column)], name: str, axis: Optional[Axis]=None, numeric_only: bool=True, **kwargs: Any) -> 'Series':
    "\n        Applies sfun to each column and returns a pd.Series where the number of rows equal the\n        number of columns.\n\n        Parameters\n        ----------\n        sfun : either an 1-arg function that takes a Column and returns a Column, or\n            a 2-arg function that takes a Column and its DataType and returns a Column.\n            axis: used only for sanity check because series only support index axis.\n        name : original pandas API name.\n        axis : axis to apply. 0 or 1, or 'index' or 'columns.\n        numeric_only : bool, default True\n            Include only float, int, boolean columns. False is not supported. This parameter\n            is mainly for pandas compatibility. Only 'DataFrame.count' uses this parameter\n            currently.\n        "
    from pyspark.pandas.series import Series, first_series
    axis = validate_axis(axis)
    if (axis == 0):
        min_count = kwargs.get('min_count', 0)
        exprs = [SF.lit(None).cast(StringType()).alias(SPARK_DEFAULT_INDEX_NAME)]
        new_column_labels = []
        for label in self._internal.column_labels:
            psser = self._psser_for(label)
            is_numeric_or_boolean = isinstance(psser.spark.data_type, (NumericType, BooleanType))
            keep_column = ((not numeric_only) or is_numeric_or_boolean)
            if keep_column:
                scol = sfun(psser)
                if (min_count > 0):
                    scol = F.when((Frame._count_expr(psser) >= min_count), scol)
                exprs.append(scol.alias(name_like_string(label)))
                new_column_labels.append(label)
        if (len(exprs) == 1):
            return Series([])
        sdf = self._internal.spark_frame.select(*exprs)
        with ps.option_context('compute.max_rows', 1):
            internal = InternalFrame(spark_frame=sdf, index_spark_columns=[scol_for(sdf, SPARK_DEFAULT_INDEX_NAME)], column_labels=new_column_labels, column_label_names=self._internal.column_label_names)
            return first_series(DataFrame(internal).transpose())
    else:
        limit = get_option('compute.shortcut_limit')
        pdf = self.head((limit + 1))._to_internal_pandas()
        pser = getattr(pdf, name)(axis=axis, numeric_only=numeric_only, **kwargs)
        if (len(pdf) <= limit):
            return Series(pser)

        @pandas_udf(returnType=as_spark_type(pser.dtype.type))
        def calculate_columns_axis(*cols: pd.Series) -> pd.Series:
            return getattr(pd.concat(cols, axis=1), name)(axis=axis, numeric_only=numeric_only, **kwargs)
        column_name = verify_temp_column_name(self._internal.spark_frame.select(self._internal.index_spark_columns), '__calculate_columns_axis__')
        sdf = self._internal.spark_frame.select((self._internal.index_spark_columns + [calculate_columns_axis(*self._internal.data_spark_columns).alias(column_name)]))
        internal = InternalFrame(spark_frame=sdf, index_spark_columns=[scol_for(sdf, col) for col in self._internal.index_spark_column_names], index_names=self._internal.index_names, index_fields=self._internal.index_fields)
        return first_series(DataFrame(internal)).rename(pser.name)