Skip to content
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: datetime64[ns] conversion to object in DataFrame constructor inconsistent #2751

Closed
jreback opened this issue Jan 25, 2013 · 1 comment
Closed

Comments

@jreback
Copy link
Contributor

jreback commented Jan 25, 2013

this seems to happend when there is an object type passed as well

In [55]: df = pd.DataFrame({'a':[1,2,4,7], 
    'b':[1.2, 2.3, 5.1, 6.3], 
    'c':list('abcd'), 
    'd':[pd.datetime(2000,1,1) for i in range(4)]})

In [56]: df
Out[56]: 
   a    b  c                    d
0  1  1.2  a  2000-01-01 00:00:00
1  2  2.3  b  2000-01-01 00:00:00
2  4  5.1  c  2000-01-01 00:00:00
3  7  6.3  d  2000-01-01 00:00:00

In [57]: df.dtypes
Out[57]: 
a      int64
b    float64
c     object
d     object

# this is ok
In [64]: df = pd.DataFrame({'a':[1,2,4,7], 'b':[1.2, 2.3, 5.1, 6.3], 'd':[pd.datetime(2000,1,1) for i in range(4)]})

In [65]: df.dtypes
Out[65]: 
a             int64
b           float64
d    datetime64[ns]

@jreback
Copy link
Contributor Author

jreback commented Jan 25, 2013

closed in #2752

@jreback jreback closed this as completed Jan 25, 2013
jreback added a commit to jreback/pandas that referenced this issue Jan 31, 2013
        0 and 1 len ndarrays
        datetimes that are single objects
        mixed datetimes and objects (GH pandas-dev#2751)
        astype now converts correctly with a datetime64 type to object, NaT are converted to np.nan
        _get_numeric_data with empty mixed-type returning empty, but index was missing
DOC: release notes updated, added missing_data section to docs, whatsnew 0.10.2
jreback added a commit to jreback/pandas that referenced this issue Feb 13, 2013
…eric

     when a list is specified; use the Series codepath
     for initial list conversion (change from using DataFrame)
TST: added test for overflow in df creation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant