-
-
Notifications
You must be signed in to change notification settings - Fork 18.9k
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
import pandas as pd
df = pd.DataFrame({"datecol": [1, 2]})
# Passes with Series
pd.to_datetime(df["datecol"])
# Fails with DataFrame
pd.to_datetime(df)
Issue Description
Converting timestamps to datetime works with Series, but fails with DataFrame
Error with DataFrame:
Traceback (most recent call last):
File "C:\Users\...\main.py", line 8, in <module>
pd.to_datetime(df)
File "C:\Users\...\.venv\Lib\site-packages\pandas\core\tools\datetimes.py", line 1075, in to_datetime
result = _assemble_from_unit_mappings(arg, errors, utc)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\...\.venv\Lib\site-packages\pandas\core\tools\datetimes.py", line 1191, in _assemble_from_unit_mappings
raise ValueError(
ValueError: to assemble mappings requires at least that [year, month, day] be specified: [day,month,year] is missing
Expected Behavior
to_datetime
should have consistent behaviour between Series & DataFrame.
Installed Versions
INSTALLED VERSIONS
commit : 4665c10
python : 3.12.10
python-bits : 64
OS : Windows
OS-release : 11
Version : 10.0.22631
machine : AMD64
processor : Intel64 Family 6 Model 140 Stepping 1, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : English_United Kingdom.1252
pandas : 2.3.2
numpy : 2.3.3
pytz : 2025.2
dateutil : 2.9.0.post0
pip : None
Cython : None
sphinx : None
IPython : None
adbc-driver-postgresql: None
adbc-driver-sqlite : None
bs4 : None
blosc : None
bottleneck : None
dataframe-api-compat : None
fastparquet : None
fsspec : None
html5lib : None
hypothesis : None
gcsfs : None
jinja2 : None
lxml.etree : None
matplotlib : None
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
psycopg2 : None
pymysql : None
pyarrow : None
pyreadstat : None
pytest : None
python-calamine : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlsxwriter : None
zstandard : None
tzdata : 2025.2
qtpy : None
pyqt5 : None