Python 从今天开始';s日期使用pandas to_datetime版本0.23.4
在老版本的熊猫中,当我这样做的时候Python 从今天开始';s日期使用pandas to_datetime版本0.23.4,python,pandas,datetime,Python,Pandas,Datetime,在老版本的熊猫中,当我这样做的时候 >>> x = pd.to_datetime('today') >>> x Timestamp('2019-03-28 00:00:00.0') 但是,在熊猫上运行时,0.23.4 >>> x = pd.to_datetime('today') >>> x Timestamp('2019-03-28 18:13:45.678015') 如何将今天的日期设置为午夜,就像在旧版本中一样??
>>> x = pd.to_datetime('today')
>>> x
Timestamp('2019-03-28 00:00:00.0')
但是,在熊猫上运行时,0.23.4
>>> x = pd.to_datetime('today')
>>> x
Timestamp('2019-03-28 18:13:45.678015')
如何将今天的日期设置为午夜,就像在旧版本中一样???在pandas 0.24.2中测试,同样的问题 解决方案是使用:
x = pd.to_datetime('today').floor('d')
print (x)
2019-03-28 00:00:00