Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
Ctrl+K

pandas.MultiIndex.to_flat_index#

MultiIndex.to_flat_index()[source]#

Convert a MultiIndex to an Index of Tuples containing the level values.

Returns:
pd.Index

Index with the MultiIndex data represented in Tuples.

See also

MultiIndex.from_tuples

Convert flat index back to MultiIndex.

Notes

This method will simply return the caller if called by anything otherthan a MultiIndex.

Examples

>>>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')

[8]ページ先頭

©2009-2025 Movatter.jp