我有一个要添加到panda中的列的datetime值列表。但是,每当我将其添加为列时,值都会更改为time stamp类型。如何获取它,以便将该列及其值保留为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'>
目前没有回答
相关问题 更多 >
编程相关推荐