home / github / pull_requests

Menu
  • Search all tables
  • GraphQL API

pull_requests: 413713886

This data as json

id node_id number state locked title user body created_at updated_at closed_at merged_at merge_commit_sha assignee milestone draft head base author_association auto_merge repo url merged_by
413713886 MDExOlB1bGxSZXF1ZXN0NDEzNzEzODg2 4033 closed 0 xr.infer_freq 20629530 <!-- Feel free to remove check-list items aren't relevant to your change --> - [x] Tests added - [x] Passes `isort -rc . && black . && mypy . && flake8` - [x] Fully documented, including `whats-new.rst` for all changes and `api.rst` for new API This PR adds a `xr.infer_freq` method to copy pandas `infer_freq` but on `CFTimeIndex` objects. I tried to subclass pandas `_FrequencyInferer` and to only override as little as possible. Two things are problematic right now and I would like to get feedback on how to implement them if this PR gets the dev's approval. 1) `pd.DatetimeIndex.asi8` returns integers representing _nanoseconds_ since 1970-1-1, while `xr.CFTimeIndex.asi8` returns _microseconds_. In order not to break the API, I patched the `_CFTimeFrequencyInferer` to store 1000x the values. Not sure if this is the best, but it works. 2) As of now, `xr.infer_freq` will fail on weekly indexes. This is because pandas is using `datetime.weekday()` at some point but cftime objects do not implement that (they use `dayofwk` instead). I'm not sure what to do? Cftime could implement it to completly mirror python's datetime or pandas could use `dayofwk` since it's available on the `TimeStamp` objects. Another option, cleaner but longer, would be to reimplement `_FrequencyInferer` from scratch. I may have time for this, cause I really think a `xr.infer_freq` method would be useful. 2020-05-05T19:39:05Z 2020-05-30T18:11:36Z 2020-05-30T18:08:27Z 2020-05-30T18:08:27Z fd9e620a84389170138cc014ee5a0213718beb78     0 9a553edae8b2b4f52e5044d89b0f0354d51b003c d1f7cb8fd95d588d3f7a7e90916c25747b90ad5a CONTRIBUTOR   13221727 https://github.com/pydata/xarray/pull/4033  

Links from other tables

  • 0 rows from pull_requests_id in labels_pull_requests
Powered by Datasette · Queries took 0.754ms