home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 1035640211

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
1035640211 I_kwDOAMm_X849up2T 5898 Update docs for Dataset `reduce` methods to indicate that non-numeric data variables are dropped 13301940 closed 0     2 2021-10-25T22:48:49Z 2022-03-12T08:17:48Z 2022-03-12T08:17:48Z MEMBER      

xr.Dataset reduce methods such as mean drop non-numeric data variables prior to the reduction. However, as far as I can tell this info isn't mentioned anywhere in the documentation/docstrings. I think this would be useful information to include here for example:

```python In [47]: import xarray as xr

In [48]: import numpy as np, pandas as pd

In [50]: ds['foo'] = xr.DataArray(np.arange(6).reshape(2, 3), dims=['x', 'y'])

In [53]: ds['bar'] = xr.DataArray(pd.date_range(start='2000', periods=6).values.reshape(2, 3), dims=['x', 'y'])

In [54]: ds Out[54]: <xarray.Dataset> Dimensions: (x: 2, y: 3) Dimensions without coordinates: x, y Data variables: foo (x, y) int64 0 1 2 3 4 5 bar (x, y) datetime64[ns] 2000-01-01 2000-01-02 ... 2000-01-06 ```

```python In [55]: ds.mean('x') Out[55]: <xarray.Dataset> Dimensions: (y: 3) Dimensions without coordinates: y Data variables: foo (y) float64 1.5 2.5 3.5

In [56]: ds.bar.mean('x') Out[56]: <xarray.DataArray 'bar' (y: 3)> array(['2000-01-02T12:00:00.000000000', '2000-01-03T12:00:00.000000000', '2000-01-04T12:00:00.000000000'], dtype='datetime64[ns]') Dimensions without coordinates: y ```

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

Links from other tables

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