-
- Notifications
You must be signed in to change notification settings - Fork 19.4k
Implement some reductions for string Series #31757
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
Changes from 1 commit
c87ce47 5365fa1 460030f 6497e16 c052feb 4312b4f b67cc56 214995f 95c83fb 4082ae3 12a2323 4a61b81 c6465e5 5c1a5fb ca99650 18800e1 3eddb73 0c1a2a3 5714c06 5e01c3f 0e4a4e2 ed01138 1128950 7c0f05d d84f5bd 7db2052 e19bbe1 df99b4f ba20705 d69b587 File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| | @@ -854,6 +854,8 @@ def reduction( | |
| mask: Optional[np.ndarray] = None, | ||
| ) -> Dtype: | ||
| | ||
| na_mask = isna(values) | ||
| | ||
| values, mask, dtype, dtype_max, fill_value = _get_values( | ||
| values, skipna, fill_value_typ=fill_value_typ, mask=mask | ||
| ) | ||
| | @@ -864,6 +866,12 @@ def reduction( | |
| result.fill(np.nan) | ||
| except (AttributeError, TypeError, ValueError): | ||
| result = np.nan | ||
| elif is_object_dtype(dtype) and na_mask.any(): | ||
| # Need to explicitly mask NA values for object dtypes | ||
| Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why? | ||
| if skipna: | ||
| result = getattr(values[~na_mask], meth)(axis) | ||
| ||
| else: | ||
| return np.nan | ||
| else: | ||
| result = getattr(values, meth)(axis) | ||
| | ||
| | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should already have the mask (pass it in when you call this).