DOC: Document that DataFrame.from_records()'s columns argument also acts as "include" · Issue #59670 · pandas-dev/pandas (original) (raw)
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.from_records.html
Documentation problem
Currently, it's not clear from the DataFrame.from_records()
docs that the columns
argument to from_records()
also has the effect of what an include
argument (or usecols
) would do. Indeed, the current wording once led someone to file a feature request asking for an include
argument to be added: #15319
However, the request was later closed when the maintainers realized the columns
argument already does this (but it's not documented, hence this issue).
Suggested fix for documentation
Add a sentence or phrase to the documentation of the columns
argument that the argument also has the effect of limiting the DataFrame to including only the columns specified. This isn't implied by the current wording, or it's at least a little ambiguous.