Skip to content

Commit

Permalink
Fixed Clip (#142)
Browse files Browse the repository at this point in the history
* fixed clip

* None checking
  • Loading branch information
osalpekar authored and devin-petersohn committed Oct 10, 2018
1 parent fb9d13b commit 357e2fc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 6 additions & 2 deletions modin/data_management/data_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -657,10 +657,14 @@ def truediv(self, other, **kwargs):
return self._inter_df_op_handler(func, other, **kwargs)

def clip(self, lower, upper, **kwargs):
kwargs["lower"] = lower
kwargs["upper"] = upper
kwargs["lower"] = lower
axis = kwargs.get("axis", 0)
func = self._prepare_method(pandas.DataFrame.clip, **kwargs)
return self.scalar_operations(kwargs.get("axis", 0), lower or upper, func)
if is_list_like(lower) or is_list_like(upper):
df = self.map_across_full_axis(axis, func)
return self.__constructor__(df, self.index, self.columns)
return self.scalar_operations(axis, lower or upper, func)

def update(self, other, **kwargs):
"""Uses other manager to update corresponding values in this manager.
Expand Down
3 changes: 3 additions & 0 deletions modin/pandas/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -904,6 +904,9 @@ def boxplot(

def clip(self, lower=None, upper=None, axis=None, inplace=False, *args, **kwargs):
# validate inputs
if axis is not None:
axis = pandas.DataFrame()._get_axis_number(axis)

if is_list_like(lower) or is_list_like(upper):
if axis is None:
raise ValueError("Must specify axis =0 or 1")
Expand Down

0 comments on commit 357e2fc

Please sign in to comment.