-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
groupby_bins returns data in reversed order #7759
Comments
Thanks for opening your first issue here at xarray! Be sure to follow the issue template! |
Ouch, thanks for finding and report this bad bug! We'll issue a bugfix release soon. |
* Fix binning by unsorted array Closes #7759 * Update xarray/tests/test_groupby.py Co-authored-by: Illviljan <14371165+Illviljan@users.noreply.github.com> --------- Co-authored-by: Illviljan <14371165+Illviljan@users.noreply.github.com>
What happened?
I have previously used
DataArray.groupby_bins
to great effect with some complex binning tasks. I recently upgraded my base Python to 3.10 and found disastrous results from code that previously worked fine. I now find that, at least with non-linear bins,groupby_bins
now produces reversed results in the resulting bin counts. The ordering of the data and coordinates are now misaligned - so I think this is a bug.For reference, I can reproduce the error in
2023.4.0
but2023.3.0
gives the correct result.What did you expect to happen?
I expect
groupby_bins
to produce the same counts as similar methods innumpy
orpandas
Minimal Complete Verifiable Example
MVCE confirmation
Relevant log output
Anything else we need to know?
No response
Environment
xarray: 2023.4.0
pandas: 2.0.0
numpy: 1.23.5
scipy: 1.10.1
netCDF4: None
pydap: None
h5netcdf: None
h5py: 3.8.0
Nio: None
zarr: None
cftime: None
nc_time_axis: None
PseudoNetCDF: None
iris: None
bottleneck: None
dask: 2023.3.2
distributed: 2023.3.2.1
matplotlib: 3.7.1
cartopy: None
seaborn: None
numbagg: None
fsspec: 2023.4.0
cupy: None
pint: None
sparse: None
flox: None
numpy_groupies: None
setuptools: 65.6.3
pip: 23.0.1
conda: 23.1.0
pytest: 7.3.1
mypy: None
IPython: 8.12.0
sphinx: None
/Users/tho822/mambaforge/lib/python3.10/site-packages/_distutils_hack/init.py:33: UserWarning: Setuptools is replacing distutils.
warnings.warn("Setuptools is replacing distutils.")
INSTALLED VERSIONS
commit: None
python: 3.9.16 | packaged by conda-forge | (main, Feb 1 2023, 21:42:20)
[Clang 14.0.6 ]
python-bits: 64
OS: Darwin
OS-release: 20.6.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: None
LOCALE: (None, 'UTF-8')
libhdf5: None
libnetcdf: None
xarray: 2023.3.0
pandas: 1.5.3
numpy: 1.24.2
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: 3.7.1
cartopy: None
seaborn: None
numbagg: None
fsspec: None
cupy: None
pint: None
sparse: None
flox: None
numpy_groupies: None
setuptools: 67.6.1
pip: 23.1
conda: None
pytest: None
mypy: None
IPython: 8.12.0
sphinx: None
/Users/tho822/mambaforge/envs/py39/lib/python3.9/site-packages/_distutils_hack/init.py:33: UserWarning: Setuptools is replacing distutils.
warnings.warn("Setuptools is replacing distutils.")
The text was updated successfully, but these errors were encountered: