Datedelta to int This is the only way work for me. Y = (Y / np.timedelta64(1, 'D')).astype(int) [1]: https://blog.csdn.net/xu200yang/article/details/70460592