to_datetime64

function of dascore.utils.time source

to_datetime64(
    obj: int | float | str | numpy.datetime64 | pandas._libs.tslibs.timestamps.Timestamp | numpy.ndarray[int, float, str, datetime64, Timestamp, ndarray] ,
)

Convert an object to a datetime64.

This function accepts a wide range of inputs and returns something of the same shape, but converted to numpy’s datetime64 representation.

Examples

# Convert an [iso 8601](https://en.wikipedia.org/wiki/ISO_8601) string
import dascore as dc
time = dc.to_datetime64('2017-09-17T12:11:01.23212')
# Convert a timestamp (float)
dt = dc.to_datetime64(631152000.0)