8000 Add to_flat_index method to MultiIndex by WillAyd · Pull Request #22866 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

Add to_flat_index method to MultiIndex #22866

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

Merged
merged 16 commits into from
Nov 13, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed up docstring
  • Loading branch information
WillAyd committed Oct 27, 2018
commit be06e7d9470e2d4b549c4bedd91cc0cafcfa9b3f
18 changes: 17 additions & 1 deletion pandas/core/indexes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1111,6 +1111,11 @@ def to_index(self, sep=None):

.. versionadded:: 0.24.0

Parameters
----------
sep : str, optional
Not yet implemented.

Returns
-------
pd.Index : an Index with the MultiIndex data represented in Tuples.
Expand All @@ -1122,7 +1127,18 @@ def to_index(self, sep=None):

See Also
--------
Index
to_series : Similar method to construct a Series.
to_frame : Similar method to construct a DataFrame.

Examples
--------
>>> index = pd.MultiIndex.from_product(
... [['foo', 'bar'], ['baz', 'qux']],
... names=['a', 'b'])
>>> index.to_index()
Index([('foo', 'baz'), ('foo', 'qux'),
('bar', 'baz'), ('bar', 'qux')],
dtype='object')
"""
if sep is not None:
# TODO: Add support for separator to return strs instad of tuples
Expand Down
0