-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
ENH: MultiIndex.from_product infers names from inputs if not explicitly provided #28417
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
ENH: MultiIndex.from_product infers names from inputs if not explicitly provided #28417
Conversation
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.
One tiny comment: https://github.com/pandas-dev/pandas/pull/28417/files#r323883775 LGTM otherwise.
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.
tiny comment, other lgtm.
pandas/core/indexes/multi.py
Outdated
@@ -508,7 +510,9 @@ def from_product(cls, iterables, sortorder=None, names=None): | |||
Level of sortedness (must be lexicographically sorted by that | |||
level). | |||
names : list / sequence of str, optional | |||
Names for the levels in the index. | |||
Names for the levels in the index. If not provided, these |
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.
can you add a versionadded directive here (1.0)
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.
Will do. Would it make sense to break it out into a ..versionchanged
?
names : list / sequence of str, optional
Names for the levels in the index.
..versionchanged 1.0
If not explicitly provided, names will be inferred from the
elements of iterables if an element has a name attribute
do we have enough testing on |
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.
Doc formatting. Looks good otherwise.
Co-Authored-By: Tom Augspurger <[email protected]>
Co-Authored-By: Tom Augspurger <[email protected]>
Co-Authored-By: Tom Augspurger <[email protected]>
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.
Verified that we do have other coverage for from_arrays
and input arrays with names.
Thanks! |
…ly provided (pandas-dev#28417) * Updated MultiIndex.from_product to infer names * Respect None names in from_arrays
…ly provided (pandas-dev#28417) * Updated MultiIndex.from_product to infer names * Respect None names in from_arrays
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff
Infers names in
MultiIndex.from_product
and normalizes handing ofnames=None
betweenfrom_arrays
andfrom_product