Skip to content

Unwanted conversion of Timestamp to long #3593

Closed
@eike-welk

Description

@eike-welk

Method combine_first performs an unwanted conversion of Timestamp to long. Pandas version is "0.11.0". Here is an IPython session demonstrating the behavior, which is IMHO a bug:

In [1]: import pandas as pd

In [2]: pd.__version__
Out[2]: '0.11.0'

In [4]: from datetime import datetime

In [5]: df0 = pd.DataFrame({"a":[datetime(2000, 1, 1), datetime(2000, 1, 2), datetime(2000, 1, 3)]})

In [6]: df0
Out[6]: 
                    a
0 2000-01-01 00:00:00
1 2000-01-02 00:00:00
2 2000-01-03 00:00:00

In [7]: df1 = pd.DataFrame({"a":[None, None, None]})

In [8]: df1
Out[8]: 
      a
0  None
1  None
2  None

In [9]: df2 = df1.combine_first(df0)

In [10]: df2
Out[10]: 
                    a
0  946684800000000000
1  946771200000000000
2  946857600000000000

In [11]: type(df2["a"][0])
Out[11]: long

In [12]: type(df0["a"][0])
Out[12]: pandas.tslib.Timestamp

I think df2 should contain time stamps like df0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions