Skip to content

Commit

Permalink
refactor GroupBy internals (#9389)
Browse files Browse the repository at this point in the history
* More tests

* Refactoring GroupBy

1. Simplify ResolvedGrouper by moving logic to EncodedGroups
2. Stack outside ResolvedGrouper in GroupBy.__init__ to prepare for
   multi-variable GroupBy

* bail on pandas 2.0
  • Loading branch information
dcherian authored Aug 21, 2024
1 parent 4ab0679 commit a56a407
Show file tree
Hide file tree
Showing 5 changed files with 238 additions and 161 deletions.
2 changes: 1 addition & 1 deletion xarray/core/coordinates.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ def _construct_direct(
return obj

@classmethod
def from_pandas_multiindex(cls, midx: pd.MultiIndex, dim: str) -> Self:
def from_pandas_multiindex(cls, midx: pd.MultiIndex, dim: Hashable) -> Self:
"""Wrap a pandas multi-index as Xarray coordinates (dimension + levels).
The returned coordinates can be directly assigned to a
Expand Down
Loading

0 comments on commit a56a407

Please sign in to comment.