You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We can currently set the dtype on an Index but there is no dtypes argument for a MultiIndex.from_tuples.
Perhaps it is enough to document how to achieve the equivalent of from_tuples by using from_arrays where the arrays are Index with a dtype set.
Feature Description
.
Alternative Solutions
.
Additional Context
.
The text was updated successfully, but these errors were encountered:
Thanks for proposing the workaround! It works for a user case mentioned in issue 59003. I will open a PR to document it.
Despite the workaround, I think initializing MultiIndex with a dtypes param should still be supported. Currently the MultiIndex constructor has a dtype parameter in its function signature, but the parameter is never accessed in the function logic. To me this seems to indicate that initializing with a dtypes param is intended, just waiting to be implemented.
The helper functions including from_arrays(), from_tuples(), from_product(), and from_frame() rely on the MultiIndex
class constructor, thus they do not take parameter for dtypes. Once relevant logic is added to the class constructor, the helper functions can also be updated.
Feature Type
Adding new functionality to pandas
Changing existing functionality in pandas
Removing existing functionality in pandas
Problem Description
See #54521 for the motivating example.
We can currently set the
dtype
on anIndex
but there is nodtypes
argument for aMultiIndex.from_tuples
.Perhaps it is enough to document how to achieve the equivalent of
from_tuples
by usingfrom_arrays
where the arrays areIndex
with a dtype set.Feature Description
.
Alternative Solutions
.
Additional Context
.
The text was updated successfully, but these errors were encountered: