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-91589696,https://api.github.com/repos/pydata/xarray/issues/388,91589696,MDEyOklzc3VlQ29tbWVudDkxNTg5Njk2,10194086,2015-04-10T15:20:02Z,2015-04-10T15:20:02Z,MEMBER,"Ok, thanks - it seems I didn't even try :P I find the name virtual_variables easier to grasp than dt, but better to be consistent with panda. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,67356079 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'] ``` ``` 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.` or `ds.time.dt.`) 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