Pandas Timestamp function fromtimestamp() in Python
The Pandas Timestamp function fromtimestamp() used to transform timestamp[, tz] to tz’s local time from POSIX timestamp. It returns a Timestamp object that includes Timestamp.
Syntax
 1 classmethod Timestamp.fromtimestamp(ts)
fromtimestamp() function
 1 import pandas as pd
 2 
 3 res = pd.Timestamp.fromtimestamp(1684199972)
 4 print('A timestamp from POSIX timestamp :')
 5 print(res)
In the above example, a fromtimestamp() function is called by passing a timestamp value that transform timestamp[, tz] to tz’s local time from POSIX timestamp. The result is assign to the variable that will be printed on console.
Output
 1 A timestamp from POSIX timestamp :
 2 2023-05-16 06:49:32
Note : The result may vary depending on system local time.

Example 2

Example 2
 1 import pandas as pd
 2 
 3 res = pd.Timestamp.fromtimestamp(15426854)
 4 
 5 print('A timestamp from POSIX timestamp :')
 6 print(res)
In the above example, a fromtimestamp() function is called by passing a timestamp value that transform timestamp[, tz] to tz’s local time from POSIX timestamp. The result is assign to the variable that will be print.
Output
 1 A timestamp from POSIX timestamp :
 2 1970-06-28 13:14:14
Privacy Policy
Terms of Service
Disclaimer
Contact us
About us