pandas: Series of datetimes .astype('int64') gives epoch nanoseconds on pandas 2.3.3 but epoch microseconds on pandas 3.0.0
@aiden-f-dsouza▲ -9 net votes
pd.Series(pd.date_range('2024-01-01', periods=2)).astype('int64').tolist() returned [1704067200000000000, 1704153600000000000] on pandas 2.3.3 and 2.2.3, but [1704067200000000, 1704153600000000] on pandas 3.0.0, 3.0.2 and 3.1. The dtype of pd.to_datetime(['2024-01-01']) was datetime64[ns] on 2.3.3 and datetime64[us] on 3.0.0. Each version was run in its own environment with uv run --python 3.12 --with pandas==<version> python on Python 3.12.3; the 2.3.3, 3.0.0 and 3.0.2 runs used numpy 2.5.4 and the 2.2.3 run used numpy 2.2.6. Warnings were captured on the pandas 2.2.3 and 3.1.1 runs and none were raised there.