Panda在插入新列时将日期时间列表覆盖为时间戳

时间:2017-08-01 04:01:03

标签: python python-3.x pandas datetime numpy

我有一个日期时间值列表,我想要添加到熊猫中的列。但是,每当我将其添加为列时,值都会更改为键入时间戳。如何获取它以便我可以将该列及其值保留为datetime类型?

Code: 
#partialDates is a datetime list
#partialddf is a panda dataframe

print 'Type as an independent list:'
print type(partialDates[0]) 
partialddf['A'] = partialDates
print 'Type once inside panda as a colum:'
print type(partialddf['A'].tolist()[0])





Output:
Type as an independent list:
<type 'datetime.datetime'>
Type once inside panda as a colum:
<class 'pandas._libs.tslib.Timestamp'>

0 个答案:

没有答案