Why numpy started converting date object to datetime64[s] type object in the newer versions ? How to make it backward compatible ?
Example:
Code snippet:
import datetime
import numpy as np
dt = datetime.date(1970, 1, 1)
array = np.array([dt], dtype='datetime64[s]')
array
Result:
**Numpy version 1.12.0**
array(['1970-01-01T00:00:00'], dtype='datetime64[s]')
**Numpy version 1.9.3**
TypeError: Cannot cast datetime.date object from metadata [D] to [s] according to the rule 'same_kind'