赞
踩
将时间戳转换为字符串,只需str(timestamp)
即可
import pandas as pd
from datetime import datetime, time, timedelta
times = []
ts = datetime(2023, 6, 17, 9, 10, 0)
while ts <= datetime(2023, 6, 17, 9, 26, 40):
# times.append(time(ts.hour, ts.minute, ts.second))
times.append(str(ts))
ts += timedelta(seconds=1)
name = ['date']
test = pd.DataFrame(columns=name, data=times)
test.to_csv('./date.csv')
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。