home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 274362263

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/issues/1084#issuecomment-274362263 https://api.github.com/repos/pydata/xarray/issues/1084 274362263 MDEyOklzc3VlQ29tbWVudDI3NDM2MjI2Mw== 6628425 2017-01-22T21:46:25Z 2017-01-22T21:46:25Z MEMBER

@shoyer @jhamman outside of an upstream issue in dateutil (what pandas uses to parse date strings), I think I have partial datetime string indexing with netcdftime objects functioning in my prototype (updated here). I've tried to simplify the logic that's in pandas wherever possible (ignoring timezones, business day / quarters logic etc.), while also modifying it such that it can handle any kind of datetime from netcdftime. It would be great if you could do another sanity check on it before I look to open up a PR.

If you think this is a path forward here, I suppose the next order of business would be for me to open up an issue in dateutil, and see what the developers there recommend. I flesh out the issue some in my notebook, but the gist of it is that for years less than 100, the default date parser behaves somewhat unpredictably.

For instance, I would expect line 5 to produce a date with year=1, and line 6 to produce a date with year=16: ```python In [1]: import dateutil

In [2]: dateutil.version Out[2]: '2.5.3'

In [3]: from dateutil import parser

In [4]: p = parser.parser()

In [5]: p._parse('0001-01-16') Out[5]: (_result(year=16, month=1, day=1), None)

In [6]: p._parse('0016-01-01') Out[6]: (_result(year=16, month=1, day=1), None) ```

and here I would want line 7 to return a result with year=1 (without a days value), as it does for years greater than or equal to 100 (line 8): ```python In [7]: p._parse('0001') Out[7]: (_result(day=1), None)

In [8]: p._parse('0100') Out[8]: (_result(year=100), None) ```

I recognize that I'm using the private API version of the parse function; however this is also what pandas does in its core (to enable picking off the resolution of the string specified). It has the additional use for me here of allowing me to convert the _result into whatever kind of datetime I'd like.

Thanks again for your help.

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