home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 666880880

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
666880880 MDU6SXNzdWU2NjY4ODA4ODA= 4278 Skipna not working in DataArray.rolling.mean 12862013 closed 0     5 2020-07-28T08:32:41Z 2022-09-06T10:39:02Z 2020-07-29T11:17:23Z CONTRIBUTOR      

What happened: I tried to calculate a rolling mean or median, ignoring nan's

Minimal Complete Verifiable Example:

```python

da = xr.DataArray([1.0, 2, 3, np.nan, 5, 6]) da.rolling(dim_0 = 3).mean(skipna=True) <xarray.DataArray (dim_0: 6)> array([nan, nan, 2., nan, nan, nan]) Dimensions without coordinates: dim_0 ```

I expected this array to have have no nans. There is a simple workaround that does give the answer I was looking for:

```python

da.rolling(dim_0 = 3).construct("new").mean("new", skipna=True) <xarray.DataArray (dim_0: 6)> array([1. , 1.5, 2. , 2.5, 4. , 5.5]) Dimensions without coordinates: dim_0 ```

Anything else we need to know?: Love the project ;-)

Environment:

Output of <tt>xr.show_versions()</tt> INSTALLED VERSIONS ------------------ commit: None python: 3.8.3 (default, May 16 2020, 07:08:28) [GCC 8.3.0] python-bits: 64 OS: Linux OS-release: 4.19.76-linuxkit machine: x86_64 processor: byteorder: little LC_ALL: None LANG: C.UTF-8 LOCALE: en_US.UTF-8 libhdf5: None libnetcdf: None xarray: 0.16.0 pandas: 1.0.5 numpy: 1.19.1 scipy: None netCDF4: None pydap: None h5netcdf: None h5py: None Nio: None zarr: None cftime: None nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: None dask: None distributed: None matplotlib: None cartopy: None seaborn: None numbagg: None pint: None setuptools: 46.4.0 pip: 20.1.1 conda: None pytest: None IPython: 7.16.1 sphinx: None
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/4278/reactions",
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed 13221727 issue

Links from other tables

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