I can't see how to reveal the units for numpy.datetime64. Say:
t=np.datetime64(123456789, 'ms' )
What's the method to tell me the units are 'ms'?
I can't see how to reveal the units for numpy.datetime64. Say:
t=np.datetime64(123456789, 'ms' )
What's the method to tell me the units are 'ms'?
                        
                            
                        
                        
                            On
                            
                                                    
                    
                As of NumPy 1.14 (Jan 2018), the datetime_data function is available to return a tuple of (units, number of base units in step) for a given datetime64 dtype:
>>> dt = np.datetime64(123456789, 'ns')
>>> np.datetime_data(dt)
('ns', 1)
>>> dt_units = np.datetime)data(dt)[0]
>>> print(dt_units)
'ns'
                        
You can query using:
from where you can see the units in
ms.