Pandas Timestamp property asm8 in Python
The Pandas Timestamp property asm8 used to retrieve the numpy datetime64 format in nanoseconds.
Syntax
 1 Timestamp.asm8
asm8 property
 1 import pandas as pd
 2 
 3 timestamp = pd.Timestamp(2022, 5, 25, 15, 45, 57)
 4 
 5 res = timestamp.asm8
 6 print('A Timestamp in datetime64 :')
 7 print(res)
In the above example, a Timestamp object is created by passing a datetime values. A property asm8 is access that returns numpy datetime64 format in nanoseconds. The result is assign to the variable that will be printed on console.
Output
 1 A Timestamp in datetime64 :
 2 2022-05-25T15:45:57.000000

Example 2

Example 2
 1 import pandas as pd
 2 
 3 timestamp = pd.Timestamp(2023, 11, 22, 22, 55, 14)
 4 
 5 res = timestamp.asm8
 6 print('A Timestamp in datetime64 :')
 7 print(res)
In the above example, a Timestamp object is created by passing a datetime values. A property asm8 is access that returns numpy datetime64 format in nanoseconds. The result is assign to the variable that will be print.
Output
 1 A Timestamp in datetime64 :
 2 2023-11-22T22:55:14.000000
Privacy Policy
Terms of Service
Disclaimer
Contact us
About us