Skip to content
Open
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
5 changes: 5 additions & 0 deletions pandas/core/array_algos/masked_reductions.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,11 @@ def std(
if not values.size or mask.all():
return libmissing.NA

# Avoid runtime warning context overhead when not necessary for performance
mask_any = mask.any() if mask.size else False
if not mask_any:
# Fast path: no missing, call directly
return np.std(values, axis=axis, ddof=ddof)
with warnings.catch_warnings():
warnings.simplefilter("ignore", RuntimeWarning)
return _reductions(
Expand Down