我有平面文件(txt),其中有日期列和值列。在
我正在尝试将新行附加到txt,以防我的数据帧接收到新行,使用循环逻辑。我有以下代码: 为了简单起见,我在这里说它等于0。在
LastDate = 0
saveFileLine = name+'.txt.'
saveFile = open(saveFileLine,'a')
for index, row in namedf.iterrows():
if int(''.join(row['Date'].split('-')[:3])) > LastDate:
lineToWrite = row+'\n'
saveFile.write(lineToWrite)
saveFile.close()
它给了我一个错误:
write()参数必须是str,而不是Series
我不知道如何使它写入当前活动的循环行。在
希望你能帮助我! 谢谢
每排都是熊猫系列。你把整排都当作一根绳子。你想写整行吗?在
相关问题 更多 >
编程相关推荐