Skip to content
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

Dataset.reduce pass through non-numeric scalars #9604

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mathause
Copy link
Collaborator

  • Closes #xxxx
  • Tests added
  • User visible changes (including notable bug fixes) are documented in whats-new.rst
  • New functions/methods are listed in api.rst

Trying to reduce a non-numeric scalar results in an error. This PR passes them through unchanged.

import xarray as xr
ds = xr.Dataset(data_vars={"y": ((), "string")})
ds.mean()
TypeError: the resolved dtypes are not compatible with add.reduce. Resolved (dtype('<U6'), dtype('<U6'), dtype('<U12'))

  • I did not find an issue for that
  • Alternatively we could skip them (this is done with non-numeric arrays)
  • Numeric scalars are still reduced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant