-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: need better inference for path in Series construction #9456
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
I am working on this issue (not at the sprint, unfortunately). |
I put some traces in the
I suggest to rewrite the if isinstance(index, DatetimeIndex) and lib.infer_dtype(data) != 'datetime64':
data = lib.fast_multiget(data, index.astype('O').values, default=np.nan)
elif isinstance(index, PeriodIndex):
data = [data.get(i, nan) for i in index]
else:
data = lib.fast_multiget(data, index.values, default=np.nan) If this is not complete nonsense, I can add a test and create a pull request. |
BUG: #10160 DataFrame construction from nested dict with datetime64 index
closed by #10269 |
isn't this still an issue? eg.
|
@ruidc what exactly do you think your above should do? If anything I would say it should raise as you have all scalar values. |
that's not what i was trying to show, I'd expect to see the values not an empty DataFrame or NaNs:
|
@ruidc If you provide a dict to The reason you get an empty dataframe is because you first give a column name 'a' (dict key), but then also provide another column name (with |
But as @jreback said, you should actually get an error:
but is seems this is not triggered when passing another column name |
Ok, i see, I made mistakes in reducing my original problem. |
maybe this shows the problem better, although it's not specific to MultiIndex:
|
yeh suppose the last is prob a bug, pls create a new issue. |
Thx for confirming, done: #10863 and sorry for the uninspired title, but i think I've been looking at this particular issue for too long to be creative. |
This hits a path in
Series.__init__
which I think needs some better inferencehttps://github.com/pydata/pandas/blob/master/pandas/core/series.py#L178
The problem is the index is already converted at this point and its not easy to get the keys/values out (except to do so explicity which is better IMHO).
Need a review of what currently hits this path (can simply put a halt in here and see what tests hit this). Then figure out a better method.
The text was updated successfully, but these errors were encountered: