home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 280101093

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/1270#issuecomment-280101093 https://api.github.com/repos/pydata/xarray/issues/1270 280101093 MDEyOklzc3VlQ29tbWVudDI4MDEwMTA5Mw== 6628425 2017-02-15T18:47:00Z 2017-02-16T02:08:32Z MEMBER

@fmaussion just to clarify, #1252 is meant as an analogue to pandas' DatetimeIndex for non-standard calendars, and does not address resample (it would be nice to have at some point though). It is not intended to be used in place of (or provide similar functionality to) a PeriodIndex.

@MaximilianR perhaps it's also worth noting (as I understand it) xarray does not yet support upsampling with filling (see #563, and the docs). That being said, independent of that, there's definitely something odd going on, since attempting to downsample via a mean produces the same error: ``` In [21]: da = xr.DataArray(pd.Series(1, pd.period_range('2000-1', '2000-12', freq='W')).rename_axis('date'))

In [22]: da.resample('M', 'date', how='mean')

TypeError Traceback (most recent call last) <ipython-input-22-9c464b8e736c> in <module>() ----> 1 da.resample('M', 'date', how='mean')

/Users/spencerclark/xarray-dev/xarray/xarray/core/common.pyc in resample(self, freq, dim, how, skipna, closed, label, base, keep_attrs) 577 time_grouper = pd.TimeGrouper(freq=freq, how=how, closed=closed, 578 label=label, base=base) --> 579 gb = self.groupby_cls(self, group, grouper=time_grouper) 580 if isinstance(how, basestring): 581 f = getattr(gb, how)

/Users/spencerclark/xarray-dev/xarray/xarray/core/groupby.pyc in init(self, obj, group, squeeze, grouper, bins, cut_kwargs) 242 raise ValueError('index must be monotonic for resampling') 243 s = pd.Series(np.arange(index.size), index) --> 244 first_items = s.groupby(grouper).first() 245 if first_items.isnull().any(): 246 full_index = first_items.index

//anaconda/envs/xarray-dev/lib/python2.7/site-packages/pandas/core/generic.pyc in groupby(self, by, axis, level, as_index, sort, group_keys, squeeze, kwargs) 3989 return groupby(self, by=by, axis=axis, level=level, as_index=as_index, 3990 sort=sort, group_keys=group_keys, squeeze=squeeze, -> 3991 kwargs) 3992 3993 def asfreq(self, freq, method=None, how=None, normalize=False):

//anaconda/envs/xarray-dev/lib/python2.7/site-packages/pandas/core/groupby.pyc in groupby(obj, by, kwds) 1509 raise TypeError('invalid type: %s' % type(obj)) 1510 -> 1511 return klass(obj, by, kwds) 1512 1513

//anaconda/envs/xarray-dev/lib/python2.7/site-packages/pandas/core/groupby.pyc in init(self, obj, keys, axis, level, grouper, exclusions, selection, as_index, sort, group_keys, squeeze, **kwargs) 368 level=level, 369 sort=sort, --> 370 mutated=self.mutated) 371 372 self.obj = obj

//anaconda/envs/xarray-dev/lib/python2.7/site-packages/pandas/core/groupby.pyc in _get_grouper(obj, key, axis, level, sort, mutated) 2390 # a passed-in Grouper, directly convert 2391 if isinstance(key, Grouper): -> 2392 binner, grouper, obj = key._get_grouper(obj) 2393 if key.key is None: 2394 return grouper, [], obj

//anaconda/envs/xarray-dev/lib/python2.7/site-packages/pandas/tseries/resample.pyc in _get_grouper(self, obj) 1059 def _get_grouper(self, obj): 1060 # create the resampler and return our binner -> 1061 r = self._get_resampler(obj) 1062 r._set_binner() 1063 return r.binner, r.grouper, r.obj

//anaconda/envs/xarray-dev/lib/python2.7/site-packages/pandas/tseries/resample.pyc in _get_resampler(self, obj, kind) 1055 raise TypeError("Only valid with DatetimeIndex, " 1056 "TimedeltaIndex or PeriodIndex, " -> 1057 "but got an instance of %r" % type(ax).name) 1058 1059 def _get_grouper(self, obj):

TypeError: Only valid with DatetimeIndex, TimedeltaIndex or PeriodIndex, but got an instance of 'Index' ```

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