pull_requests: 30491293
This data as json
id | node_id | number | state | locked | title | user | body | created_at | updated_at | closed_at | merged_at | merge_commit_sha | assignee | milestone | draft | head | base | author_association | auto_merge | repo | url | merged_by |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
30491293 | MDExOlB1bGxSZXF1ZXN0MzA0OTEyOTM= | 361 | closed | 0 | Add resample, first and last | 1217238 | Fixes #354 `resample` lets you resample a dataset or array along a time axis to a coarser resolution. The syntax is the same as pandas, except you need to supply the time dimension explicitly: ``` In [1]: time = pd.date_range('2000-01-01', freq='6H', periods=10) In [2]: array = xray.DataArray(np.arange(10), [('time', time)]) In [3]: array.resample('1D', dim='time') Out[3]: <xray.DataArray (time: 3)> array([ 1.5, 5.5, 8.5]) Coordinates: * time (time) datetime64[ns] 2000-01-01 2000-01-02 2000-01-03 ``` You can specify how to do the resampling with the how argument and other options such as closed and label let you control labeling: ``` In [4]: array.resample('1D', dim='time', how='sum', label='right') Out[4]: <xray.DataArray (time: 3)> array([ 6, 22, 17]) Coordinates: * time (time) datetime64[ns] 2000-01-02 2000-01-03 2000-01-04 ``` `first` and `last` methods on groupby objects let you take the first or last examples from each group along the grouped axis: ``` In [5]: array.groupby('time.day').first() Out[5]: <xray.DataArray (day: 3)> array([0, 4, 8]) Coordinates: * day (day) int64 1 2 3 ``` | 2015-03-04T18:32:24Z | 2015-03-05T19:29:42Z | 2015-03-05T19:29:39Z | 2015-03-05T19:29:39Z | eefca5e51afa2af5df3991b7ff4da570408787cd | 1004936 | 0 | 2358989b61c743a794e007d2324249f95964b5f8 | 7187bb9af9b2fffedb931dcaa3766b58e769a13e | MEMBER | 13221727 | https://github.com/pydata/xarray/pull/361 |
Links from other tables
- 2 rows from pull_requests_id in labels_pull_requests