Skip to content

localize_tso unnecessary calls? #17944

Closed
@jbrockmendel

Description

@jbrockmendel

Related: #17876, #17734

In tslib._localize_tso there are 4 of blocks of the form:

        if obj.value != NPY_NAT:
            pandas_datetime_to_datetimestruct(obj.value + delta,
                                              PANDAS_FR_ns, &obj.dts)
        else:
            pandas_datetime_to_datetimestruct(obj.value,
                                              PANDAS_FR_ns, &obj.dts)

But in the case where obj.value == NPY_NAT, can't we skip the call to pandas_datetime_to_datetimestruct because we're going to end up with NaT anyway?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions