'How to convert datetime64[ns] to datetime.datetime

I have a data-fame whose index is of datetime64[ns] type

Now I have another date-time object which is of datetime.datetime, based on this object I have to subset the dataframe.

Is there any way to convert datetime.datetime to datetime64[ns]?

Any pointer will be very helpful



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source