MultiIndex.to_flat_index(self) [source]
Convert a MultiIndex to an Index of Tuples containing the level values.
New in version 0.24.0.
| Returns: |
|
|---|
This method will simply return the caller if called by anything other than a MultiIndex.
>>> index = pd.MultiIndex.from_product(
... [['foo', 'bar'], ['baz', 'qux']],
... names=['a', 'b'])
>>> index.to_flat_index()
Index([('foo', 'baz'), ('foo', 'qux'),
('bar', 'baz'), ('bar', 'qux')],
dtype='object')
© 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_flat_index.html