Home > Enterprise >  Where can I find documentation for pd.Timestamp.value
Where can I find documentation for pd.Timestamp.value

Time:08-20

I checked these two sources:

but still unclear with what it does. I'm not very familiar with cython code.

Just based on poking around, it seems to return the number of nanoseconds since epoch.

>>> import pandas as pd
>>> ts = pd.Timestamp("1970-01-01")
>>> ts.value
0
>>> ts = pd.Timestamp("1970-01-01 00:00:00.123")
>>> ts.value                                    
123000000
>>> ts = pd.Timestamp("1969-12-31 23:59:59")    
>>> ts.value
-1000000000

I wonder if it's documented somewhere.

CodePudding user response:

It's not explicitly documented, but yes - value is the count of resolutions (defined as Timedelta('0 days 00:00:00.000000001') = 1 ns) since epoch:

>>> import pandas as pd
>>> ts = pd.Timestamp("1970-01-01 00:00:00.123")
>>> ts.resolution * ts.value
Timedelta('0 days 00:00:00.123000')

See also:

Epoch timestamps:

The default unit is nanoseconds, since that is how Timestamp objects are stored internally.

Timestamp limitations:

Since pandas represents timestamps in nanosecond resolution, ...

  • Related