-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
PERF: nested dict DataFrame construction #11158
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,6 +52,8 @@ | |
|
||
from pandas.tseries.period import PeriodIndex | ||
from pandas.tseries.index import DatetimeIndex | ||
from pandas.tseries.tdi import TimedeltaIndex | ||
|
||
|
||
import pandas.core.algorithms as algos | ||
import pandas.core.base as base | ||
|
@@ -5400,8 +5402,13 @@ def _homogenize(data, index, dtype=None): | |
v = v.reindex(index, copy=False) | ||
else: | ||
if isinstance(v, dict): | ||
v = _dict_compat(v) | ||
oindex = index.astype('O') | ||
if oindex is None: | ||
oindex = index.astype('O') | ||
|
||
if isinstance(index, (DatetimeIndex, TimedeltaIndex)): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't remember why we do this, but is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is to handle the case where the dict had AFAIK not needed for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, can you move all of these types of tests to the same location (e.g. out of test_period, not sure where datetimeindex/timedeltaindex are) and prob into test_frame (though I hate adding to this, its really IS part of it). |
||
v = _dict_compat(v) | ||
else: | ||
v = dict(v) | ||
v = lib.fast_multiget(v, oindex.values, default=NA) | ||
v = _sanitize_array(v, index, dtype=dtype, copy=False, | ||
raise_cast_failure=False) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add with dateimelikes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, this affected any type