home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 554481913

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/pull/3537#issuecomment-554481913 https://api.github.com/repos/pydata/xarray/issues/3537 554481913 MDEyOklzc3VlQ29tbWVudDU1NDQ4MTkxMw== 6213168 2019-11-15T18:47:21Z 2019-11-15T18:50:38Z MEMBER

@dopplershift fully agree.

is this the only place of min for datetimes?

This PR does not fix the nan-reductions for datetime arrays.

It very narrowly fixes the use case of mean() and nanmean() with a numpy backend, so that they work on numpy 1.18 as they did on 1.17. As a matter of fact they never worked with dask, were never tested, and still won't work after the PR.

To emphasize: I am not introducing any new feature or fixing bugs on numpy 1.17; I'm just getting rid of regressions on the upgrade from 1.17 to 1.18.

Specifically, the PR fixes this failing test: https://github.com/pydata/xarray/blob/aa876cfd6b3b97ee5028d089ec741d057e3ed688/xarray/tests/test_duck_array_ops.py#L276-L293

which was not well formulated - despite its name, it doesn't test all reductions, only mean(), and in fact never runs on dask (the index of a dask array is not chunked). I have now rewritten it for the sake of clarity.

If numpy/numpy#14841 makes into master before 1.18 is published, and if it actually delivers on making reductions work with NaT (I did not test it yet), I'll be happy to write a second PR and rework everything. Even then, a switch of this sort will still be needed:

python def datetime_nanmin(array, **kwargs): if LooseVersion(numpy.__version__) < "1.18": return np.min(array, **kwargs) else: return np.nanmin(array, **kwargs) The actual code will be in fact more complicated because you also need to think about dask.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  523438384
Powered by Datasette · Queries took 0.648ms · About: xarray-datasette