Skip to content

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

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

Closed
1 task done
scotscotmcc opened this issue Nov 13, 2024 · 2 comments · Fixed by #60310
Closed
1 task done
Assignees
Labels
Docs good first issue IO Data IO issues that don't fit into a more specific label

Comments

@scotscotmcc
Copy link

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.

@scotscotmcc scotscotmcc added Docs Needs Triage Issue that has not been reviewed by a pandas team member labels Nov 13, 2024
@rhshadrach
Copy link
Member

Thanks for the report, PRs to fix are welcome!

@rhshadrach rhshadrach added IO Data IO issues that don't fit into a more specific label good first issue and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Nov 14, 2024
@U-S-jun
Copy link
Contributor

U-S-jun commented Nov 14, 2024

take

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs good first issue IO Data IO issues that don't fit into a more specific label
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants