Skip to content
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

DOC: Extend docstring pandas core index to_frame method #20036

Merged
5 changes: 3 additions & 2 deletions pandas/core/indexes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1110,13 +1110,14 @@ def to_series(self, index=None, name=None):
return Series(self._to_embed(), index=index, name=name)

def to_frame(self, index=True):
"""Create a DataFrame with a column containing the Index.
"""
Create a DataFrame with a column containing the Index.

.. versionadded:: 0.21.0

Parameters
----------
index : boolean (default True)
index : boolean, default True
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jorisvandenbossche on the docstring guide rst file, the example dosctring provides: color : str (default 'blue'). So should it be (default True) or , default True?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, I was using the virtual in my head :-) That's something we need to fix, we decided on , default True I think

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set the index of the returned DataFrame as the original Index.

Returns
Expand Down