def sum(self, axis: Optional[Axis]=None, numeric_only: bool=None, min_count: int=0) -> Union[(Scalar, 'Series')]:
    "\n        Return the sum of the values.\n\n        Parameters\n        ----------\n        axis : {index (0), columns (1)}\n            Axis for the function to be applied on.\n        numeric_only : bool, default None\n            Include only float, int, boolean columns. False is not supported. This parameter\n            is mainly for pandas compatibility.\n        min_count : int, default 0\n            The required number of valid values to perform the operation. If fewer than\n             ``min_count`` non-NA values are present the result will be NA.\n\n        Returns\n        -------\n        sum : scalar for a Series, and a Series for a DataFrame.\n\n        Examples\n        --------\n\n        >>> df = ps.DataFrame({'a': [1, 2, 3, np.nan], 'b': [0.1, np.nan, 0.3, np.nan]},\n        ...                   columns=['a', 'b'])\n\n        On a DataFrame:\n\n        >>> df.sum()\n        a    6.0\n        b    0.4\n        dtype: float64\n\n        >>> df.sum(axis=1)\n        0    1.1\n        1    2.0\n        2    3.3\n        3    0.0\n        dtype: float64\n\n        >>> df.sum(min_count=3)\n        a    6.0\n        b    NaN\n        dtype: float64\n\n        >>> df.sum(axis=1, min_count=1)\n        0    1.1\n        1    2.0\n        2    3.3\n        3    NaN\n        dtype: float64\n\n        On a Series:\n\n        >>> df['a'].sum()\n        6.0\n\n        >>> df['a'].sum(min_count=3)\n        6.0\n        >>> df['b'].sum(min_count=3)\n        nan\n        "
    axis = validate_axis(axis)
    if ((numeric_only is None) and (axis == 0)):
        numeric_only = True
    elif ((numeric_only is True) and (axis == 1)):
        numeric_only = None

    def sum(spark_column: Column, spark_type: DataType) -> Column:
        if isinstance(spark_type, BooleanType):
            spark_column = spark_column.cast(LongType())
        elif (not isinstance(spark_type, NumericType)):
            raise TypeError('Could not convert {} ({}) to numeric'.format(spark_type_to_pandas_dtype(spark_type), spark_type.simpleString()))
        return F.coalesce(F.sum(spark_column), SF.lit(0))
    return self._reduce_for_stat_function(sum, name='sum', axis=axis, numeric_only=numeric_only, min_count=min_count)
Return the sum of the values.

Parameters
----------
axis : {index (0), columns (1)}
    Axis for the function to be applied on.
numeric_only : bool, default None
    Include only float, int, boolean columns. False is not supported. This parameter
    is mainly for pandas compatibility.
min_count : int, default 0
    The required number of valid values to perform the operation. If fewer than
     ``min_count`` non-NA values are present the result will be NA.

Returns
-------
sum : scalar for a Series, and a Series for a DataFrame.

Examples
--------

>>> df = ps.DataFrame({'a': [1, 2, 3, np.nan], 'b': [0.1, np.nan, 0.3, np.nan]},
...                   columns=['a', 'b'])

On a DataFrame:

>>> df.sum()
a    6.0
b    0.4
dtype: float64

>>> df.sum(axis=1)
0    1.1
1    2.0
2    3.3
3    0.0
dtype: float64

>>> df.sum(min_count=3)
a    6.0
b    NaN
dtype: float64

>>> df.sum(axis=1, min_count=1)
0    1.1
1    2.0
2    3.3
3    NaN
dtype: float64

On a Series:

>>> df['a'].sum()
6.0

>>> df['a'].sum(min_count=3)
6.0
>>> df['b'].sum(min_count=3)
nan
def sum(self, axis: Optional[Axis]=None, numeric_only: bool=None, min_count: int=0) -> Union[(Scalar, 'Series')]:
    "\n        Return the sum of the values.\n\n        Parameters\n        ----------\n        axis : {index (0), columns (1)}\n            Axis for the function to be applied on.\n        numeric_only : bool, default None\n            Include only float, int, boolean columns. False is not supported. This parameter\n            is mainly for pandas compatibility.\n        min_count : int, default 0\n            The required number of valid values to perform the operation. If fewer than\n             ``min_count`` non-NA values are present the result will be NA.\n\n        Returns\n        -------\n        sum : scalar for a Series, and a Series for a DataFrame.\n\n        Examples\n        --------\n\n        >>> df = ps.DataFrame({'a': [1, 2, 3, np.nan], 'b': [0.1, np.nan, 0.3, np.nan]},\n        ...                   columns=['a', 'b'])\n\n        On a DataFrame:\n\n        >>> df.sum()\n        a    6.0\n        b    0.4\n        dtype: float64\n\n        >>> df.sum(axis=1)\n        0    1.1\n        1    2.0\n        2    3.3\n        3    0.0\n        dtype: float64\n\n        >>> df.sum(min_count=3)\n        a    6.0\n        b    NaN\n        dtype: float64\n\n        >>> df.sum(axis=1, min_count=1)\n        0    1.1\n        1    2.0\n        2    3.3\n        3    NaN\n        dtype: float64\n\n        On a Series:\n\n        >>> df['a'].sum()\n        6.0\n\n        >>> df['a'].sum(min_count=3)\n        6.0\n        >>> df['b'].sum(min_count=3)\n        nan\n        "
    axis = validate_axis(axis)
    if ((numeric_only is None) and (axis == 0)):
        numeric_only = True
    elif ((numeric_only is True) and (axis == 1)):
        numeric_only = None

    def sum(spark_column: Column, spark_type: DataType) -> Column:
        if isinstance(spark_type, BooleanType):
            spark_column = spark_column.cast(LongType())
        elif (not isinstance(spark_type, NumericType)):
            raise TypeError('Could not convert {} ({}) to numeric'.format(spark_type_to_pandas_dtype(spark_type), spark_type.simpleString()))
        return F.coalesce(F.sum(spark_column), SF.lit(0))
    return self._reduce_for_stat_function(sum, name='sum', axis=axis, numeric_only=numeric_only, min_count=min_count)