home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 218355316

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/846#issuecomment-218355316 https://api.github.com/repos/pydata/xarray/issues/846 218355316 MDEyOklzc3VlQ29tbWVudDIxODM1NTMxNg== 1217238 2016-05-11T03:53:50Z 2016-05-11T03:53:50Z MEMBER

Actually, p.values in your first example is a datetime64 scalar. NumPy scalars support .item(), though.

So I think one reasonable approach would be to implement .item() for pandas.Period, too. One difference is that there is no native Python scalar for periods, so I would probably just make .item() a no-op.

Side note: that the behavior you show for DatetimeIndex/datetime64[ns] is actually a bug in NumPy related to nanosecond precision:

``` In [4]: np.array(np.datetime64('2000-01-01', 'us')).item() Out[4]: datetime.datetime(2000, 1, 1, 0, 0)

In [5]: np.array(np.datetime64('2000-01-01', 's')).item() Out[5]: datetime.datetime(2000, 1, 1, 0, 0)

In [6]: np.array(np.datetime64('2000-01-01', 'ns')).item() Out[6]: 946684800000000000 ```

It's probably worth filing on bug report, if one doesn't already exist...

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