-
-
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
sel with categorical index #3670
Conversation
I don't think the check failure is related. |
Hello @fujiisoup! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
Comment last updated at 2020-01-25 00:59:20 UTC |
I think this PR is ready for review. |
I'll merge this tomorrow if no more commens. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to look over the code but didn't find anything except some stylistic issues which I don't feel strongly about. Other than that this looks good to me (I don't know much about this part of xarray, though).
levels = [] | ||
for i, level in enumerate(index.levels): | ||
if isinstance(level, pd.CategoricalIndex): | ||
level = level[index.codes[i]].remove_unused_categories() | ||
levels.append(level) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like this could be cleaner by using a list comprehension:
levels = [
level[index.codes[i]].remove_unused_categories()
if isinstance(level, pd.CategoricalIndex)
else level
for i, level in enumerate(index.levels)
]
though that might be just me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor comments. Thanks @fujiisoup
unless I'm missing something this should be really close (run black once and fix the merge conflict in |
* 'master' of github.com:pydata/xarray: (27 commits) bump min deps for 0.15 (pydata#3713) setuptools-scm and isort tweaks (pydata#3720) Allow binned coordinates on 1D plots y-axis. (pydata#3685) apply_ufunc: Add meta kwarg + bump dask to 2.2 (pydata#3660) setuptools-scm and one-liner setup.py (pydata#3714) Feature/align in dot (pydata#3699) ENH: enable `H5NetCDFStore` to work with already open h5netcdf.File a… (pydata#3618) One-off isort run (pydata#3705) hardcoded xarray.__all__ (pydata#3703) Bump mypy to v0.761 (pydata#3704) remove DataArray and Dataset constructor deprecations for 0.15 (pydata#3560) Tests for variables with units (pydata#3654) Add an example notebook using apply_ufunc to vectorize 1D functions (pydata#3629) Use encoding['dtype'] over data.dtype when possible within CFMaskCoder.encode (pydata#3652) allow passing any iterable to drop when dropping variables (pydata#3693) Typo on DataSet/DataArray.to_dict documentation (pydata#3692) Fix mypy type checking tests failure in ds.merge (pydata#3690) Explicitly convert result of pd.to_datetime to a timezone-naive type (pydata#3688) ds.merge(da) bugfix (pydata#3677) fix docstring for combine_first: returns a Dataset (pydata#3683) ...
should be ready for merging now |
* master: Add support for CFTimeIndex in get_clean_interp_index (pydata#3631) sel with categorical index (pydata#3670) bump min deps for 0.15 (pydata#3713) setuptools-scm and isort tweaks (pydata#3720) Allow binned coordinates on 1D plots y-axis. (pydata#3685) apply_ufunc: Add meta kwarg + bump dask to 2.2 (pydata#3660) setuptools-scm and one-liner setup.py (pydata#3714) Feature/align in dot (pydata#3699) ENH: enable `H5NetCDFStore` to work with already open h5netcdf.File a… (pydata#3618) One-off isort run (pydata#3705) hardcoded xarray.__all__ (pydata#3703) Bump mypy to v0.761 (pydata#3704) remove DataArray and Dataset constructor deprecations for 0.15 (pydata#3560) Tests for variables with units (pydata#3654) Add an example notebook using apply_ufunc to vectorize 1D functions (pydata#3629) Use encoding['dtype'] over data.dtype when possible within CFMaskCoder.encode (pydata#3652)
black . && mypy . && flake8
whats-new.rst
for all changes andapi.rst
for new APIIt is a bit surprising that no members have used xarray with CategoricalIndex...
If there is anything missing additionally, please feel free to point it out.