home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 59840149

This data as json

id node_id number title user state locked assignee milestone comments created_at updated_at closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
59840149 MDExOlB1bGxSZXF1ZXN0MzA0OTEyOTM= 361 Add resample, first and last 1217238 closed 0   1004936 0 2015-03-04T18:32:24Z 2015-03-05T19:29:42Z 2015-03-05T19:29:39Z MEMBER   0 pydata/xarray/pulls/361

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

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/361/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    13221727 pull

Links from other tables

  • 2 rows from issues_id in issues_labels
  • 0 rows from issue in issue_comments
Powered by Datasette · Queries took 157.926ms · About: xarray-datasette