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

_datetime_nanmin() broken (TypeError) #403

Open
RondeauG opened this issue Nov 12, 2024 · 2 comments
Open

_datetime_nanmin() broken (TypeError) #403

RondeauG opened this issue Nov 12, 2024 · 2 comments

Comments

@RondeauG
Copy link

RondeauG commented Nov 12, 2024

There appears to be either a typo (min instead of np.nanmin) or a missing import in the new _datetime_nanmin function.

Specifically, line 363:
array = min(array, skipna=True)

Always results in:
TypeError: 'skipna' is an invalid keyword argument for min()

Permalink:
https://github.com/xarray-contrib/flox/blob/4f6164f74a657d95f795c374e31e91a7e7643e9f/flox/xrutils.py#L363C5-L363C36

@dcherian
Copy link
Collaborator

dang it. Can you provide an example please? Clearly the current test suite isn't good enough.

@RondeauG
Copy link
Author

RondeauG commented Nov 12, 2024

This is failing for me with flox v0.9.14 and xarray v2024.9.0.

ds = xr.tutorial.open_dataset("air_temperature")
ds.time.resample(time="D").count()

EDIT: An example using flox directly:

import flox
import numpy as np
array = np.array([np.datetime64("2000-01-01"), np.datetime64("2000-01-02"), np.datetime64("2000-01-03")])
by = [np.array([0, 0, 1])]
flox.groupby_reduce(array, by, func="nanmin")

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

No branches or pull requests

2 participants