Skip to content

Commit

Permalink
DOC: Extend docstring pandas core index to_frame method (pandas-dev#2…
Browse files Browse the repository at this point in the history
  • Loading branch information
stijnvanhoey authored and pandres committed Mar 10, 2018
1 parent 559847a commit c36f8a2
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion pandas/core/indexes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1148,7 +1148,26 @@ def to_frame(self, index=True):
Returns
-------
DataFrame : a DataFrame containing the original Index data.
DataFrame
DataFrame containing the original Index data.
Examples
--------
>>> idx = pd.Index(['Ant', 'Bear', 'Cow'], name='animal')
>>> idx.to_frame()
animal
animal
Ant Ant
Bear Bear
Cow Cow
By default, the original Index is reused. To enforce a new Index:
>>> idx.to_frame(index=False)
animal
0 Ant
1 Bear
2 Cow
"""

from pandas import DataFrame
Expand Down

0 comments on commit c36f8a2

Please sign in to comment.