excel的浮点型数字转换成时间格式
import pandas as pd#读取数据,把电子表格里的时间(浮点数表示的),转换成年,月,日,时,分,秒
df = pd.read_excel('test2.xlsx')
# print(df.head())
# print(df.dtypes)
df['new_time'] = pd.to_datetime(df['充值成功时间'],unit='D', origin=pd.Timestamp('1899-12-31'))
print(df.head())
页:
[1]