Skip to content

BUG: inferring incorrect datetime format #51476

Closed
@jbrockmendel

Description

@jbrockmendel
dtstr = "2014 Jan 9 05:15 FAKE"
arg = np.array([dtstr], dtype=object)

>>> pd.core.tools.datetimes._guess_datetime_format_for_array(arg, dayfirst=None)
'%Y %b %d %H:%M FAKE'

Because _guess_datetime_format_for_array keeps "FAKE", to_datetime then goes through _array_strptime_with_fallback, which drops the bad tz completely.

Not sure exactly where to catch this, but need to handle it somewhere in order to deprecate #18702.

cc @MarcoGorelli

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugDatetimeDatetime data dtypeNeeds 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