-
-
Notifications
You must be signed in to change notification settings - Fork 19.1k
Description
Pandas version checks
- I have checked that this issue has not already been reported.
- I have confirmed this bug exists on the latest version of pandas.
- I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
In [1]: import pandas as pd
In [2]: pd.to_datetime(0, origin=0)
Out[2]: Timestamp('1970-01-01 00:00:00')
In [3]: pd.to_datetime(0, origin=1)
Out[3]: Timestamp('1970-01-01 00:00:00.000000001')
In [4]: pd.__version__
Out[4]: '2.0.3'
In [5]: pd.to_datetime(0, origin=1)
Out[5]: Timestamp('1970-01-01 00:00:00.000000001')
In [6]: pd.to_datetime(1, unit="ns")
Out[6]: Timestamp('1970-01-01 00:00:00.000000001')
In [7]: pd.to_datetime(1, unit="ns") == pd.to_datetime(0, origin=1)
Out[7]: True
In [8]: pd.to_datetime(1, unit="ms") == pd.to_datetime(0, origin=1)
Out[8]: False
Issue Description
The documentation for pandas v2.0.3 state that an int or float origin will be treated as milliseconds and added to the epoch time, but seems like its being treated as nanoseconds? Not sure if this is a bug, or a typo in the documentation!
Expected Behavior
The resulting timestamp for pd.to_datetime(0, origin=1)
should be equivalent to pd.to_datetime(1, unit="ms")
.
Installed Versions
INSTALLED VERSIONS
commit : 0f43794
python : 3.8.17.final.0
python-bits : 64
OS : Darwin
OS-release : 21.3.0
Version : Darwin Kernel Version 21.3.0: Wed Jan 5 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_X86_64
machine : x86_64
processor : i386
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 2.0.3
numpy : 1.24.4
pytz : 2023.3
dateutil : 2.8.2
setuptools : 68.0.0
pip : 23.2.1
Cython : None
pytest : 7.4.0
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.9.3
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : 8.12.2
pandas_datareader: None
bs4 : 4.12.2
bottleneck : None
brotli : None
fastparquet : None
fsspec : 2023.6.0
gcsfs : None
matplotlib : 3.7.2
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : 10.0.1
pyreadstat : None
pyxlsb : None
s3fs : 0.4.2
scipy : 1.10.1
snappy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
zstandard : None
tzdata : 2023.3
qtpy : None
pyqt5 : None