I am using Pandas to obtain EPOCH timestamps, i.e. nanoseconds since January 1, 1970 (midnight UTC/GMT), from human-friendly data/time input. Everything was fine until I recently updated the Anaconda environment. Now, I do not understand if I made a mistake (high probability) or there is maybe a bug in the update package.
Until the recent rounds of updates the following sequence of commands produced an integer number giving the EPOCH time in nanoseconds:
ts = pd.Timestamp('2021-04-25 12:13:30', tz='Europe/Berlin')
ts_new = np.int64(ts.asm8)
1619345610000000000
However, now the result is simply
1619345610
It looks like since I did not bother to give milliseconds, microseconds, and nanoseconds, these are now omitted instead of assumed to be zero. However, according to the Pandas documentation asm8 should "Return numpy datetime64 format in nanoseconds." This is clearly not the case now.
What did I do wrong? Or might this be a bug?
Addendum:
ts = pd.to_datetime('2021-04-25 12:13:30')
ts_new = np.int64(ts.asm8)
1619352810000000000
So, this still works as expected. But here I am missing the functionality to define a timezone and let Pandas take care of everything else.
P.S. Here is the output of pd.show_version().
INSTALLED VERSIONS
------------------
commit : 0f437949513225922d851e9581723d82120684a6
python : 3.11.3.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.19045
machine : AMD64
processor : Intel64 Family 6 Model 158 Stepping 9, GenuineIntel
byteorder : little
LC_ALL : None
LANG : en
LOCALE : de_DE.cp1252
pandas : 2.0.3
numpy : 1.24.3
pytz : 2022.7
dateutil : 2.8.2
setuptools : 67.8.0
pip : 23.1.2
Cython : None
pytest : 7.4.0
hypothesis : None
sphinx : 5.0.2
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.9.2
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.1.2
IPython : 8.15.0
pandas_datareader: None
bs4 : 4.12.2
bottleneck : 1.3.5
brotli :
fastparquet : None
fsspec : 2023.4.0
gcsfs : None
matplotlib : 3.7.2
numba : 0.57.1
numexpr : 2.8.4
odfpy : None
openpyxl : 3.0.10
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : 2023.4.0
scipy : 1.11.1
snappy :
sqlalchemy : 1.4.39
tables : 3.8.0
tabulate : 0.8.10
xarray : 2023.6.0
xlrd : None
zstandard : 0.19.0
tzdata : 2023.3
qtpy : 2.2.0
pyqt5 : None
Unfortunately, I do not know how to check which versions were installed previously (before the update).