Skip to content

DOC: Dataframe.from_records should not say that passing in a DataFrame for data is allowed #60307

Closed
@scotscotmcc

Description

@scotscotmcc

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/dev/reference/api/pandas.DataFrame.from_records.html#pandas.DataFrame.from_records

Documentation problem

The first text in the docstring says (emphasis at the end is mine)

Convert structured or record ndarray to DataFrame.

Creates a DataFrame object from a structured ndarray, sequence of
tuples or dicts, or DataFrame.

However, starting in 2.1.0, passing in a DataFrame has been deprecated. In 2.1.0 it would raise a FutureWarning; in main it will raise a TyperError.

The documentation between 2.1.0 and main appear to have been updated to remove text in the Parameters section of the docstring that still said a DataFrame could be passed in for data, but the text in the initial section of the docstring was not.

Suggested fix for documentation

Change the initial docstring text to be:

Convert structured or record ndarray to DataFrame.

Creates a DataFrame object from a structured ndarray or sequence of
tuples or dicts.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions