Skip to content

ENH: Support non-nano inference in to_datetime #55096

Closed
@mroeschke

Description

@mroeschke

Feature Type

  • Adding new functionality to pandas

  • Changing existing functionality in pandas

  • Removing existing functionality in pandas

Problem Description

In [1]: import pandas as pd

In [2]: pd.to_datetime("1677-01-01 00:00:00")
OutOfBoundsDatetime: Out of bounds nanosecond timestamp: 1677-01-01 00:00:00, at position 0

In [3]: pd.Timestamp("1677-01-01 00:00:00")
Out[3]: Timestamp('1677-01-01 00:00:00')

Feature Description

It would be great if to_datetime would perform unit inference like Timestamp.

Looks mainly an issue with array_to_datetime still assuming ns resolution for strings

Alternative Solutions

Use Timestamp

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementNon-Nanodatetime64/timedelta64 with non-nanosecond resolution

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions