home / github / commits

Menu
  • GraphQL API
  • Search all tables

commits: 59f57f3e410aca19a722c4a0d84359bde9852fbf

This data as json

sha message author_date committer_date raw_author raw_committer repo author committer
59f57f3e410aca19a722c4a0d84359bde9852fbf Fix indexing with datetime64[ns] with pandas=1.1 (#4292) * Fix indexing with datetime64[ns] with pandas=1.1 Fixes #4283 The underlying issue is that calling `.item()` on a NumPy array with `dtype=datetime64[ns]` returns an _integer_, rather than an `np.datetime64 scalar. This is somewhat baffling but works this way because `.item()` returns native Python types, but `datetime.datetime` doesn't support nanosecond precision. `pandas.Index.get_loc` used to support these integers, but now is more strict. Hence we get errors. We can fix this by using `array[()]` to convert 0d arrays into NumPy scalars instead of calling `array.item()`. I've added a crude regression test. There may well be a better way to test this but I haven't figured it out yet. * lint fix * add a test checking the datetime indexer * use label.item() for non-datetime / timedelta labels * unpin pandas in the docs * ignore the future warning about deprecated arguments to pandas.Grouper * Update xarray/core/indexing.py Co-authored-by: keewis <keewis@users.noreply.github.com> * Add whatsnew note Co-authored-by: Keewis <keewis@posteo.de> Co-authored-by: Maximilian Roos <5635139+max-sixty@users.noreply.github.com> Co-authored-by: keewis <keewis@users.noreply.github.com> 2020-09-16T01:33:29Z 2020-09-16T01:33:29Z f10b21bed2846b879806f87039b77245b18e7671 cd792325681cbad9f663f2879d8b69f1edbb678f 13221727 1217238 19864447
Powered by Datasette · Queries took 82.94ms · About: xarray-datasette