使用大型csv文件作为查找以在DataFrame中填充数据的最佳方法 [英] Best way to use big csv file as lookup to fill data in DataFrame
本文介绍了使用大型csv文件作为查找以在DataFrame中填充数据的最佳方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个DataFrame,其中的一列需要用大型csv文件中的值填充。
将csv文件加载并将数据左联接到DataFrame的最佳方式(可能是内存和计算效率高)?
I have a DataFrame with a column that needs to be filled with values from a big csv file. What would be the best (possibly memory and computation efficient) way to load in the csv file and left-join the data to the DataFrame?
我已经尝试过/考虑过:
The approaches I have tried/considered:
- 以DataFrame的形式将csv文件加载并使用pandas函数进行连接:但是,加载失败
- 装入数据库中的csv文件并使用左联接查询:我还没有尝试过此操作,但是我希望避免MemoryError 。
推荐答案
Probably an approach could be using dask and particularly dask read_csv.
在任何情况下,如@jazreal所建议,您可以考虑将其存储在SQL数据库。
In any case you may consider, as suggested by @jazreal, to store it in an SQL db.
这篇关于使用大型csv文件作为查找以在DataFrame中填充数据的最佳方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文