MultiIndex.to_hierarchical(self, n_repeat, n_shuffle=1)
[source]
Return a MultiIndex reshaped to conform to the shapes given by n_repeat and n_shuffle.
Deprecated since version 0.24.0.
Useful to replicate and rearrange a MultiIndex for combination with another Index with n_repeat items.
Parameters: |
|
---|---|
Returns: |
|
>>> idx = pd.MultiIndex.from_tuples([(1, 'one'), (1, 'two'), (2, 'one'), (2, 'two')]) >>> idx.to_hierarchical(3) MultiIndex([(1, 'one'), (1, 'one'), (1, 'one'), (1, 'two'), (1, 'two'), (1, 'two'), (2, 'one'), (2, 'one'), (2, 'one'), (2, 'two'), (2, 'two'), (2, 'two')], )
© 2008–2012, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/0.25.0/reference/api/pandas.MultiIndex.to_hierarchical.html