Skip to content

Conversation

kawochen
Copy link
Contributor

@kawochen kawochen commented Jun 4, 2015

closes #10160
closes #9456
where DataFrame/Series construction from nested dict with datetime64 index returns a DataFrame\Series of NaNs.

@jreback
Copy link
Contributor

jreback commented Jun 4, 2015

pls rebase on master and repush had an issue in the builds

@jreback jreback added Bug Reshaping Concat, Merge/Join, Stack/Unstack, Explode Dtype Conversions Unexpected or buggy dtype conversions labels Jun 4, 2015
@jreback jreback added this to the 0.16.2 milestone Jun 4, 2015
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for completeness, pls also do a test (you can use a loop), with datetime.datetime and Timestamp (expected should be the same)

@jreback
Copy link
Contributor

jreback commented Jun 4, 2015

ok, this overlaps with the issue in #9456 , currently with a PR of #9924 to fix

@jreback
Copy link
Contributor

jreback commented Jun 4, 2015

lets define a function someting like:

put in pandas.core.common

def _dict_compat(d):
    return { _maybe_box_datetimelike(key) : value for key, value in compat.iteritems(d) } 

then can use in both places.

@jreback
Copy link
Contributor

jreback commented Jun 5, 2015

@kawochen looks good so far. can you add in tests/fix for #9456 ?
i'd like to fix both in this PR (this PR can then supersede #9924)

@kawochen
Copy link
Contributor Author

kawochen commented Jun 6, 2015

Sure I will do that.

@kawochen kawochen force-pushed the BUG-FIX-10160 branch 3 times, most recently from 607a87d to 7ddf7d4 Compare June 8, 2015 06:10
BUG: GH9456/10160 in Series/DataFrame construction from datetime64 dict

Added _dict_compat to deal with datetime64-keyed dict
BUG: GH9456 Series construction from dict with datetime64 keys
BUG: GH10160 DataFrame construction from nested dict with datetime64 index

removed import
@jreback
Copy link
Contributor

jreback commented Jun 10, 2015

@kawochen any progress on this? (e.g. incorporating the Series fix as well)

@kawochen
Copy link
Contributor Author

Yes I did that a few days ago. I squashed the commits when I rebased (I'm new to github, maybe I shouldn't have?).

@jreback
Copy link
Contributor

jreback commented Jun 10, 2015

merged via 821542f

thanks!

FYI, when you push again, I don't know you updated (e.g. there is no notiifcation on that, only on a new PR). So if you want me to have a look, ping!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Dtype Conversions Unexpected or buggy dtype conversions Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pd.DataFrame.from_dict fails when index is numpy.datetime BUG: need better inference for path in Series construction
2 participants