我试图每隔一段时间(例如3秒(逐个传输行(从一个数据帧传输到另一个(,但我对结果感到困惑。
我现在分享我的代码:
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'])
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)
谢谢大家。
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)