我使用pyhton脚本来管理采集系统中的不同日志文件,boards ecc。我正在构建一个大的dataframe,它是其他dfs的合并,最后我将其放入csv文件,在最后一行下面:
dF_COMP.to_csv(path1 + nomefile, sep=';', decimal= ',' , columns=columns)
我想在csv的第一行添加一行配置参数。
我可以用dataframe构建csv,然后再次打开它,然后添加该行,但我认为这不是最好的主意,因为我希望构建更大的文件......有更好的主意吗?
1条答案
按热度按时间wxclj1h51#
我可以用 Dataframe 构建csv,然后再次打开它,然后添加该行,但我认为这不是最好的主意,因为我希望构建甚至大文件...
反其道而行之:
使用
pd.read_csv
再次读取文件: