-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
pd.Timestamp.timestamp() doesn't match stdlib #29779
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
We diverge from the stdlib timestamp in quite a few ways so hard to judge if that is really problematic or not. What is the larger problem you are trying to solve? |
Yah, for tz-naive we implement |
The pandas behavior is what I was expecting from
One issue is that in an app where datetimes are coming a database via I don't have an answer for whether this should be changed. My first choice is for |
At the moment we have a comment in the Timestamp.timestamp method noting that it will behave differently from stdlib; putting that in the docstring would be worthwhile. |
@arsturges does your thumbs-up indicate that you're interested in working on this? |
Closing as duplicate of #22450. |
edit: See #29779 (comment)
I searched for this among open issues but couldn't find it. Apologies in advance if I overlooked an existing issue, resolved or otherwise.
Python3 docs explain that datetime.datetime.timestamp() assume local time if no tzinfo is specified: "Naive datetime instances are assumed to represent local time and this method relies on the platform C mktime() function to perform the conversion."
Problem description
I expected the behavior of pd.Timestamp.timestamp to match that of the stdlib (datetime.datetime.stdlib). Instead, pd.Timestamp.timestamp appears to treat naive timestamps differently.
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : None
python : 3.7.4.final.0
python-bits : 64
OS : Darwin
OS-release : 18.7.0
machine : x86_64
processor : i386
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 0.25.1
numpy : 1.17.2
pytz : 2019.2
dateutil : 2.8.0
pip : 19.3.1
setuptools : 40.8.0
Cython : 0.29.13
pytest : 5.2.2
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : 2.8.3 (dt dec pq3 ext lo64)
jinja2 : 2.10.1
IPython : 7.8.0
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : None
matplotlib : 3.1.1
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
s3fs : None
scipy : None
sqlalchemy : 1.3.8
tables : None
xarray : None
xlrd : None
xlwt : None
xlsxwriter : None
The text was updated successfully, but these errors were encountered: