How to convert from pandas.DatetimeIndex to numpy.datetime64?
datetime, numpy, pandas, python
Solution
The data inside is of `datetime64` dtype (`datetime64[ns]` to be precise). Just take the `values` attribute of the index. Note it will be nanosecond unit.
Problem
How to convert from `pandas.DatetimeIndex` to `numpy.datetime64`? I get: ``` >>> type(df.index.to_datetime()) Out[56]: pandas.tseries.index.DatetimeIndex ``` Is it safe to do `numpy.array(datetimeindex,dtype=numpy.datetime64)`?