Skip to content

DOC: DataFrame.reset_index names param can't be a tuple as docs state #57994

Closed
@alexandermorgan

Description

@alexandermorgan

Pandas version checks

  • I have checked that the issue still exists on the latest versions of the docs on main here

Location of the documentation

https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.reset_index.html

Documentation problem

In the description of the names parameter, the declared type in bold is correct: "int, str or 1-dimensional list, default None"

But the expanded description that immediately follows incorrectly states that names can be a tuple: "If the DataFrame has a MultiIndex, this has to be a list or tuple with length equal to the number of levels."

This is incorrect because passing a tuple as the names parameter raises this error: 'raise ValueError("Index names must be str or 1-dimensional list")'

Suggested fix for documentation

Remove " or tuple" from the expanded documentation description. This will cause it to match the bold-face type description, and more importantly accurately reflect the behavior. I can submit a PR for this if that's preferred.

Metadata

Metadata

Assignees

Labels

DocsIndexingRelated to indexing on series/frames, not to indexes themselves

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions