Skip to content

API: Timestamp and Timedelta .value changing in 2.0 #49076

Closed
@jbrockmendel

Description

@jbrockmendel
import pandas as pd
import numpy as np

dt = np.datetime64("2016-01-01", "ms")
ts = pd.Timestamp(dt)

>>> ts.value
1451606400000        # <- 2.0/main
1451606400000000000  # <- 1.x

In previous versions .value has always been in nanoseconds. By changing the reso we get with some Timestamp/Timedelta inputs, we change the .value, which is technically public API.

One option would be just to document the change in .value behavior along with the other breaking changes docs.

Another would be to use e.g. ._value internally and keep .value as representing nanos.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Non-Nanodatetime64/timedelta64 with non-nanosecond resolutionTimedeltaTimedelta data typeTimestamppd.Timestamp and associated methods

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions