Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
ENH: Named tuple fields as column names #11181
Comments
|
You could do this, but you would have to then deal with potentially multiple names here (for a single column), and should raise in that case. This is unambiguous with a recarray, but you are passing a list of records-likes here. FYI this is the same for |
jreback
added the
API Design
label
Sep 24, 2015
|
any reason you are not simply using |
|
@jreback - we're using SQLAlchemy as an ORM, so we have a SQLAlchemy Query object, which encapsulates joins & filtering. My understanding is that those methods take a Thanks |
|
I hear you re performance, if you have to check every item. I had thought that if the first item a Without that convenience, it does seem like a lot of lifting for pandas vs the benefit. |
|
this is prob not that crazy to add |
|
side issue: pydata#4916 love to remove from_records entirely (and just have it figured out in the constructor) |
|
@MaximilianR regarding the sqlalchemy Query object. At the moment this will indeed not work with |
|
@jorisvandenbossche Yes, that works, thanks! I asked a Q to SQLAlchemy, to see if those guys had any guidance. I could imagine a few options - leave it as-is, allow |
MaximilianR commentedSep 23, 2015
Currently, passing a list of
namedtuples (or SQLAlchemy results, which is our specific case) toDataFrame.from_recordsdoesn't resolve the field names.I think it would make sense to, at least if the names are all the same. Happy to do a PR if people agree.
Desired behavior: