-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
ENH: Named tuple fields as column names #11181
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
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 |
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: #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 |
Currently, passing a list of
namedtuple
s (or SQLAlchemy results, which is our specific case) toDataFrame.from_records
doesn'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:
The text was updated successfully, but these errors were encountered: