Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Python Pandas - Return a numpy timedelta64 array scalar view in nanoseconds
To return a numpy timedelta64 array scalar view in nanoseconds, use the timedelta.asm8 property in Pandas.
At first, import the required libraries −
import pandas as pd
Example
Following is the code
import pandas as pd
# TimeDeltas is Python’s standard datetime library uses a different representation timedelta’s
# create a Timedelta object
timedelta = pd.Timedelta('10 min 20 s')
# display the Timedelta
print("Timedelta...\n", timedelta)
# getting the timedelta64 in nanoseconds
res = timedelta.asm8
# display the timedelta64
print("\nTimedelta64 array scalar view...\n", res)
Output
This will produce the following code
Timedelta... 0 days 00:10:20 Timedelta64 array scalar view... 620000000000 nanoseconds
Advertisements