Skip to content

BUG: Incorrect guess_datetime_format response #61663

Closed as duplicate of#57452
Closed as duplicate of#57452
@logan-dunbar

Description

@logan-dunbar

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

print(pd.tseries.api.guess_datetime_format('2025-06-15T21:25:00.000000Z'))
print(pd.tseries.api.guess_datetime_format('2025-06-15T20:24:00.000000Z'))
print(pd.tseries.api.guess_datetime_format('2025-06-15T20:25:00.000000Z'))

# %Y-%m-%dT%H:%M:%S.%f%z
# %Y-%m-%dT%H:%M:%S.%f%z
# None

Issue Description

I'm receiving a strange None from guess_datetime_format for a very particular string combination. I can change the hours and minutes separately and it works fine, but when I set the time to exactly 20:25 it produces a None result.

Expected Behavior

It should produce the same '%Y-%m-%dT%H:%M:%S.%f%z' format as the other two examples.

Installed Versions

INSTALLED VERSIONS

commit : 2cc3762
python : 3.10.12
python-bits : 64
OS : Linux
OS-release : 6.15.1-061501-generic
Version : #202506041425 SMP PREEMPT_DYNAMIC Wed Jun 4 18:01:32 UTC 2025
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : C.UTF-8
LANG : C.UTF-8
LOCALE : en_US.UTF-8
pandas : 2.3.0
numpy : 1.26.4
pytz : 2025.2
dateutil : 2.9.0.post0
pip : 25.0.1
Cython : 0.29.37
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 : 2024.6.1
html5lib : None
hypothesis : None
gcsfs : None
jinja2 : 3.1.4
lxml.etree : None
matplotlib : 3.10.3
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 : 1.11.1
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlsxwriter : None
zstandard : None
tzdata : 2025.2
qtpy : None
pyqt5 : None

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugDatetimeDatetime data dtypeDuplicate ReportDuplicate issue or pull requestNeeds TriageIssue that has not been reviewed by a pandas team member

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions