Skip to content
39 changes: 31 additions & 8 deletions python/ray/dataframe/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,8 @@ def groupby(self, by=None, axis=0, level=None, as_index=True, sort=True,
return DataFrameGroupBy(self, by, axis, level, as_index, sort,
group_keys, squeeze, **kwargs)

def sum(self, axis=None, skipna=True, level=None, numeric_only=None):
def sum(self, axis=None, skipna=True, level=None, numeric_only=None,
min_count=0):
"""Perform a sum across the DataFrame.

Args:
Expand All @@ -616,7 +617,7 @@ def sum(self, axis=None, skipna=True, level=None, numeric_only=None):
"""
def remote_func(df):
return df.sum(axis=axis, skipna=skipna, level=level,
numeric_only=numeric_only)
numeric_only=numeric_only, min_count=min_count)

return self._arithmetic_helper(remote_func, axis, level)

Expand Down Expand Up @@ -2741,15 +2742,37 @@ def pow(self, other, axis='columns', level=None, fill_value=None):

def prod(self, axis=None, skipna=None, level=None, numeric_only=None,
min_count=0, **kwargs):
raise NotImplementedError(
"To contribute to Pandas on Ray, please visit "
"github.com/ray-project/ray.")
"""Perform a product across the DataFrame.

Args:
axis (int): The axis to product on.
skipna (bool): True to skip NA values, false otherwise.

Returns:
The product of the DataFrame.
"""
def remote_func(df):
return df.prod(axis=axis, skipna=skipna, level=level,
numeric_only=numeric_only, min_count=min_count)

return self._arithmetic_helper(remote_func, axis, level)

def product(self, axis=None, skipna=None, level=None, numeric_only=None,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pandas defines product as an alias of prod, so we should do the same.

min_count=0, **kwargs):
raise NotImplementedError(
"To contribute to Pandas on Ray, please visit "
"github.com/ray-project/ray.")
"""Perform a product across the DataFrame.

Args:
axis (int): The axis to product on.
skipna (bool): True to skip NA values, false otherwise.

Returns:
The product of the DataFrame.
"""
def remote_func(df):
return df.product(axis=axis, skipna=skipna, level=level,
numeric_only=numeric_only, min_count=min_count)

return self._arithmetic_helper(remote_func, axis, level)

def quantile(self, q=0.5, axis=0, numeric_only=True,
interpolation='linear'):
Expand Down
Loading