-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Closed
Labels
Compatpandas objects compatability with Numpy or Python functionspandas objects compatability with Numpy or Python functionsDatetimeDatetime data dtypeDatetime data dtypeDeprecateFunctionality to remove in pandasFunctionality to remove in pandasNeeds DiscussionRequires discussion from core team before further actionRequires discussion from core team before further action
Description
Code Sample, a copy-pastable example if possible
import datetime as dt
import pandas as pd
t = dt.datetime.now()
ts1 = t.timestamp()
ts2 = pd.Timestamp(t).timestamp()
print((ts1 - ts2) / 3600)
Problem description
Pandas and Datetime evidently have different defaults when handling time objects for which tzinfo=None
. This changed somewhere in between pandas 0.19 and 0.23 (upgrading broke a bunch of my tests). I think keeping consistency between these two libraries would remove some of the confusion in the bizarrely complicated area that is python time-handling.
In the example, the two timestamp floats should match. Currently, my understanding is the datetime library defaults to the current timezone whereas Pandas assumes GMT. There isn't information in the Pandas API documentation regarding how Timestamp.timestamp()
handles naive Timestamps (link).
Metadata
Metadata
Assignees
Labels
Compatpandas objects compatability with Numpy or Python functionspandas objects compatability with Numpy or Python functionsDatetimeDatetime data dtypeDatetime data dtypeDeprecateFunctionality to remove in pandasFunctionality to remove in pandasNeeds DiscussionRequires discussion from core team before further actionRequires discussion from core team before further action