home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 91359416

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/388#issuecomment-91359416 https://api.github.com/repos/pydata/xarray/issues/388 91359416 MDEyOklzc3VlQ29tbWVudDkxMzU5NDE2 1217238 2015-04-09T21:22:09Z 2015-04-09T21:22:09Z MEMBER

The short answer: they do have virtual variables, just not a virtual_variables attribute:

import pandas as pd import numpy as np import xray t = pd.date_range('2000-01-01', '2000-12-31', freq='6H') x = np.random.rand(*t.shape) time = xray.DataArray(t, name='t', dims='time') print time['time.month']

<xray.DataArray 'month' (time: 1461)> array([ 1, 1, 1, ..., 12, 12, 12], dtype=int32) Coordinates: * time (time) datetime64[ns] 2000-01-01 2000-01-01T06:00:00 2000-01-01T12:00:00 ...

I actually recently removed the virtual_variables attribute from Dataset on the development version. A cleaner way to handle virtual variables would be to add a .dt attribute like pandas, e.g., time.dt.month. That would also support discovery (e.g., time.dt.<tab> or ds.time.dt.<tab>) better than a special attribute to list permissible strings.

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