Reputation: 1883
Trying to understand why t1
takes current date whereas t2
takes the epoch date in Pandas in Python. Any thoughts would help.
import pandas as pd
t1 = pd.Timestamp("23:12:05")
print("t1:",t1)
t2 = pd.Timestamp(1)
print("t2:"t2)
Output:
t1: 2024-07-23 23:12:05
t2: 1970-01-01 00:00:00.000000001
Upvotes: 0
Views: 61
Reputation: 244
There are essentially three calling conventions for the constructor of pd.Timestamp
, the one you are using in both case is the first one.
It takes either a datetime-like string (t1) or a float representing a Unix epoch (number of seconds since 1970-01-01) in units of seconds (t2).
You can read more here (pandas documentation)
Upvotes: 0