8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 559847a commit c36f8a2Copy full SHA for c36f8a2
pandas/core/indexes/base.py
@@ -1148,7 +1148,26 @@ def to_frame(self, index=True):
1148
1149
Returns
1150
-------
1151
- DataFrame : a DataFrame containing the original Index data.
+ DataFrame
1152
+ DataFrame containing the original Index data.
1153
+
1154
+ Examples
1155
+ --------
1156
+ >>> idx = pd.Index(['Ant', 'Bear', 'Cow'], name='animal')
1157
+ >>> idx.to_frame()
1158
+ animal
1159
1160
+ Ant Ant
1161
+ Bear Bear
1162
+ Cow Cow
1163
1164
+ By default, the original Index is reused. To enforce a new Index:
1165
1166
+ >>> idx.to_frame(index=False)
1167
1168
+ 0 Ant
1169
+ 1 Bear
1170
+ 2 Cow
1171
"""
1172
1173
from pandas import DataFrame
0 commit comments