-
-
Notifications
You must be signed in to change notification settings - Fork 17.6k
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
BUG: df.from_records() is all kinds of broken #2179
Comments
Indeed this code has been fairly neglected. I'll see if I can easily fix some of the issues you raised |
A major issue here is that the index argument is overloaded to take either index field names or an array to be used as the index. This was a pretty bone-headed decision made a long time ago |
agreed, that was a bit too flexible. But if the loop for removing the columns I couldn't figure out a way to get the main ctor to plug data in as columns rather |
I'm adding a docs clarification about what |
I'm pretty sure if you move the if/else setting result_index above |
Test case? |
no need, I see you've removed the if entirely. |
What still needs to get fixed here? |
support for duplicate columns is still missing. other then that I think it's good. |
columns
argument gets clobbered:In [13]: pd.DataFrame.from_records({1:["foo"],2:["bar"]},columns=['a','b']).columns
Out[13]: Index([1, 2], dtype=int64)
index
is specified, andresult_index
computed, it will get clobberedlater on.
index
is specified as a list of labels, with the first few matching columns namesand the others not, then sdict will get mutilated, because the removal of columns
occurs within the try clause rather then after success.
EDIT - ignore, I misread the code.
and The exclusion and float coercsion which are unique to
from_records()
would be usefulto have generally available in the main ctor anyway.
columns
argument should be specified relative to the originaldata, or relative to the data modulo excluded columns
a warning)
data
, which do not include a dict.But the code specifically checks and handles dict input, This is a minor thing, but
using
columns
along with dict is not well defined because of key (non-)ordering,so the original docstring spec seems more sane.
The text was updated successfully, but these errors were encountered: