Frage

Suppose T is numpy.datetime64 in units of ms. Is there a less obscure way to convert the units than this?

T1 = np.array( [T], dtype = 'datetime64[ns]' )[0]

I'm prefer something more guessable, and, for that matter, readable.

War es hilfreich?

Lösung

Is this what you're looking for?

>>> x = numpy.datetime64('2005-02-25T03:30Z', 'ms')
>>> x
numpy.datetime64('2005-02-24T22:30:00.000-0500')
>>> numpy.datetime64(x, 'ns')
numpy.datetime64('2005-02-24T22:30:00.000000000-0500')
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top