You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently only found out through a StackOverflow answer that the DataFrame constructor can take a list of namedtuples and automatically infers column names from it. Until then I had only found the DataFrame.from_records constructor, which manually requires specifying columns=Namedtuple._fields.
After searching the documentation for namedtuple, I haven't been able to find an explicit mention of constructors accepting namedtuples, while there is apparently explicit code in the constructor to deal with them nicely. Currently it only finds mentions where internal functions return rows as namedtuples.
I would propose adding an explicit mention and/or example somewhere that these kinds of inputs are accepted/encouraged, such that they can be easily found when searching for the 'namedtuple' keyword.
I can write a similar paragraph as for dataclasses in the intro to data structures, if that is indeed the right place for this.
The text was updated successfully, but these errors were encountered:
Location of the documentation
User guide 'Intro to data structures'
(alternatively
DataFrame
API docs)Documentation problem
I recently only found out through a StackOverflow answer that the
DataFrame
constructor can take a list of namedtuples and automatically infers column names from it. Until then I had only found theDataFrame.from_records
constructor, which manually requires specifyingcolumns=Namedtuple._fields
.After searching the documentation for namedtuple, I haven't been able to find an explicit mention of constructors accepting namedtuples, while there is apparently explicit code in the constructor to deal with them nicely. Currently it only finds mentions where internal functions return rows as namedtuples.
In contrast, searching for e.g. 'dataclass' finds an explicit paragraph listing the option.
Suggested fix for documentation
I would propose adding an explicit mention and/or example somewhere that these kinds of inputs are accepted/encouraged, such that they can be easily found when searching for the 'namedtuple' keyword.
I can write a similar paragraph as for dataclasses in the intro to data structures, if that is indeed the right place for this.
The text was updated successfully, but these errors were encountered: