To return a numpy.datetime64
format in nanoseconds in python, we make use of the .asm8
attribute in Pandas' Timestamp
, which is an equivalent of Python's Datetime
.
Note: This link tells more about the
datetime64
datatype in NumPy.
Timestamp.asm8
This attribute takes no parameter value.
This attribute returns the numpy.datetime64
format in nanoseconds of the input Timestamp
object.
# A code to illustrate the .asm8 attribute in Pandas # importing the pandas library import pandas as pd # creating a Timestamp object a = pd.Timestamp(2022, 4, 19, 8, 30) # applying the .asm8 attribute print(a.asm8)
pandas
library.Timestamp
object, a
.numpy.datetime64
format of the input object using the .asm
attribute.RELATED TAGS
CONTRIBUTOR
View all Courses