pydata / pydata/xarray

Some aggregate operations using the array API fail

Open
#7,243 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug topic-arrays
Dominant language
Python
Stars
4.2k
Forks
1.4k
Avg merge
2d 15h
Merged PRs (30d)
14

Description

What happened?

Here are some tests demonstrating the problem https://github.com/pydata/xarray/commit/9d6269de9fec4c66aeade2fdf9829c6e066a6eac:

FAILED xarray/tests/test_array_api.py::test_aggregation[max] - assert False
FAILED xarray/tests/test_array_api.py::test_aggregation[min] - assert False
FAILED xarray/tests/test_array_api.py::test_aggregation[mean] - assert False
FAILED xarray/tests/test_array_api.py::test_aggregation[prod] - assert False
FAILED xarray/tests/test_array_api.py::test_aggregation[std] - assert False
FAILED xarray/tests/test_array_api.py::test_aggregation[var] - assert False
FAILED xarray/tests/test_array_api.py::test_aggregation_skipna[std] - TypeError: std() got an unexpected keyword argument 'ddof'
FAILED xarray/tests/test_array_api.py::test_aggregation_skipna[var] - TypeError: var() got an unexpected keyword argument 'ddof'
What did you expect to happen?

No response

Minimal Complete Verifiable Example

No response

MVCE confirmation
  • Minimal example — the example is as focused as reasonably possible to demonstrate the underlying issue in xarray.
  • Complete example — the example is self-contained, including all data and the text of any traceback.
  • Verifiable example — the example copy & pastes into an IPython prompt or Binder notebook, returning the result.
  • New issue — a search of GitHub Issues suggests this is not a duplicate.
Relevant log output

No response

Anything else we need to know?

No response

Environment

INSTALLED VERSIONS

commit: 9d6269de9fec4c66aeade2fdf9829c6e066a6eac
python: 3.8.13 (default, Mar 28 2022, 06:16:26)
[Clang 12.0.0 ]
python-bits: 64
OS: Darwin
OS-release: 21.6.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: en_GB.UTF-8
LOCALE: ('en_GB', 'UTF-8')
libhdf5: None
libnetcdf: None

xarray: 2022.6.1.dev63+ge6791852a
pandas: 1.5.0
numpy: 1.23.3
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
fsspec: None
cupy: None
pint: None
sparse: None
flox: None
numpy_groupies: None
setuptools: 63.4.1
pip: 22.1.2
conda: None
pytest: 7.1.3
IPython: None
sphinx: None

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the failing cases in xarray/tests/test_array_api.py, especially test_aggregation and test_aggregation_skipna, and run those tests at the reported commit. Trace the array API aggregate operations and compare the failures with NumPy's aggregation behavior; done means all listed max, min, mean, prod, std, and var cases pass, including skipna handling of ddof.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, python
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.