有两个时间变量(就是日期),在python中怎么求两者间隔的天数?
2个回答
>>> from datetime import date
>>> delta = date.today() - date(2017,1,1)
>>> delta.days
387
>>> import pandas as pd
>>> t1 = pd.to_datetime('2017-10-01')
>>> t2 = pd.to_datetime('2018-02-01')
>>> (t2 - t1).days
123