Skip to content

Eliminated the skipna / dropna inconsistency in the docs. #34209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -8367,7 +8367,7 @@ def _count_level(self, level, axis=0, numeric_only=False):
return result

def _reduce(
self, op, name, axis=0, skipna=True, numeric_only=None, filter_type=None, **kwds
self, op, name, axis=0, dropna=True, numeric_only=None, filter_type=None, **kwds
):

assert filter_type is None or filter_type == "bool", filter_type
Expand Down Expand Up @@ -8400,7 +8400,7 @@ def _reduce(
constructor = self._constructor

def f(x):
return op(x, axis=axis, skipna=skipna, **kwds)
return op(x, axis=axis, dropna=dropna, **kwds)

def _get_data(axis_matters):
if filter_type is None:
Expand Down Expand Up @@ -8431,9 +8431,9 @@ def _get_data(axis_matters):

def blk_func(values):
if isinstance(values, ExtensionArray):
return values._reduce(name, skipna=skipna, **kwds)
return values._reduce(name, dropna=dropna, **kwds)
else:
return op(values, axis=1, skipna=skipna, **kwds)
return op(values, axis=1, dropna=dropna, **kwds)

# After possibly _get_data and transposing, we are now in the
# simple case where we can use BlockManager._reduce
Expand Down Expand Up @@ -8562,7 +8562,7 @@ def nunique(self, axis=0, dropna=True) -> Series:
"""
return self.apply(Series.nunique, axis=axis, dropna=dropna)

def idxmin(self, axis=0, skipna=True) -> Series:
def idxmin(self, axis=0, dropna=True) -> Series:
"""
Return index of first occurrence of minimum over requested axis.

Expand All @@ -8572,7 +8572,7 @@ def idxmin(self, axis=0, skipna=True) -> Series:
----------
axis : {0 or 'index', 1 or 'columns'}, default 0
The axis to use. 0 or 'index' for row-wise, 1 or 'columns' for column-wise.
skipna : bool, default True
dropna : bool, default True
Exclude NA/null values. If an entire row/column is NA, the result
will be NA.

Expand Down Expand Up @@ -8624,7 +8624,7 @@ def idxmin(self, axis=0, skipna=True) -> Series:
dtype: object
"""
axis = self._get_axis_number(axis)
indices = nanops.nanargmin(self.values, axis=axis, skipna=skipna)
indices = nanops.nanargmin(self.values, axis=axis, dropna=dropna)

# indices will always be np.ndarray since axis is not None and
# values is a 2d array for DataFrame
Expand All @@ -8635,7 +8635,7 @@ def idxmin(self, axis=0, skipna=True) -> Series:
result = [index[i] if i >= 0 else np.nan for i in indices]
return self._constructor_sliced(result, index=self._get_agg_axis(axis))

def idxmax(self, axis=0, skipna=True) -> Series:
def idxmax(self, axis=0, dropna=True) -> Series:
"""
Return index of first occurrence of maximum over requested axis.

Expand All @@ -8645,7 +8645,7 @@ def idxmax(self, axis=0, skipna=True) -> Series:
----------
axis : {0 or 'index', 1 or 'columns'}, default 0
The axis to use. 0 or 'index' for row-wise, 1 or 'columns' for column-wise.
skipna : bool, default True
dropna : bool, default True
Exclude NA/null values. If an entire row/column is NA, the result
will be NA.

Expand Down Expand Up @@ -8697,7 +8697,7 @@ def idxmax(self, axis=0, skipna=True) -> Series:
dtype: object
"""
axis = self._get_axis_number(axis)
indices = nanops.nanargmax(self.values, axis=axis, skipna=skipna)
indices = nanops.nanargmax(self.values, axis=axis, dropna=dropna)

# indices will always be np.ndarray since axis is not None and
# values is a 2d array for DataFrame
Expand Down