In order to account for the units, I think you need to do something like:
def get_unixtime(dt64):
return dt64.astype('datetime64[s]').astype('int')
Note that this converts to 'seconds' (the [s]
) prior to converting to integers. This works on NumPy 1.12.1.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…