我试图每隔一定时间(例如 3 秒)逐行传输行(从一个数据帧到另一个数据帧),但我坚持结果。我现在分享我的代码:import pandas as pdimport timefile_name = 'schio_000_orig.csv'cor_file = pd.read_csv(file_name, sep=',', header=None, usecols=[0,1,2,3,4,5,6,7,8,9], names=['COL_1', 'DATE', 'TIME','X', 'N','Y','E','DATA', 'COL_2','COL_3'])largo = len(cor_file)base = cor_file.loc[[0]] #appended_data = []appended_data = cor_file.loc[[0]]for i in range(largo): data = cor_file.loc[[i]] appended_data.append(data) print(appended_data) time.sleep(2)appended_data = pd.concat(appended_data)谢谢大家。
1 回答
小唯快跑啊
TA贡献1863条经验 获得超2个赞
import pandas as pd
import time
file_name = 'schio_000_orig.csv'
cor_file = pd.read_csv(file_name,
sep=',',
header=None,
usecols=[0,1,2,3,4,5,6,7,8,9],
names=['COL_1', 'DATE', 'TIME','X', 'N','Y','E','DATA', 'COL_2','COL_3'])
appended_data = pd.DataFrame()
for row, cont in cor_file.iterrows():
appended_data = appended_data.append(cont)
time.sleep(2)
print(appended_data)
添加回答
举报
0/150
提交
取消