Quantcast
Channel: Time difference in seconds from numpy.timedelta64 - Stack Overflow
Browsing index pages (4 articles)

Answer by Dema for Time difference in seconds from numpy.timedelta64

You can simply cast the value to the desired time unit using np.astype, as shown in the example:timedelta = np.datetime64('2011-07-18')-np.datetime64('2011-07-16')seconds =...

View Article


Time difference in seconds from numpy.timedelta64

How to get time difference in seconds from numpy.timedelta64 variable? time1 = '2012-10-05 04:45:18' time2 = '2012-10-05 04:44:13' dt = np.datetime64(time1) - np.datetime64(time2) print dt 0:01:05 I'd...

View Article


Answer by wim for Time difference in seconds from numpy.timedelta64

You can access it through the "wrapped" datetime item: >>> dt.item().total_seconds() 65.0 Explanation: here dt is an array scalar in numpy, which is a zero rank array or 0-dimensional array....

View Article

Answer by jfs for Time difference in seconds from numpy.timedelta64

To get number of seconds from numpy.timedelta64() object using numpy 1.7 experimental datetime API: seconds = dt / np.timedelta64(1, 's')

View Article
Browsing index pages (4 articles)


Latest Images