简体   繁体   English

read_csv如何在python中精确地工作?

[英]How read_csv exactly works in python?

I want to read from a csv file using python. 我想使用python从csv文件读取。 I am working on memory management, so I would like to ask: When I call read_csv of pandas module in python, the data from the file are loaded to the RAM memory and then read, or are they read straight from the disk? 我正在进行内存管理,所以我想问:当我在python中调用pandas模块的read_csv时,文件中的数据会加载到RAM内存中然后读取,还是直接从磁盘读取? If I want to read the csv file in chunks will the data be loaded chunk by chunk in RAM ? 如果我想分块读取csv文件,是否会在RAM中逐块加载数据?

See the documentation : 请参阅文档

Also supports optionally iterating or breaking of the file into chunks. 还可以选择支持将文件迭代或拆分为块。

and

chunksize : int, optional chunksize :int,可选

Return TextFileReader object for iteration. 返回TextFileReader对象以进行迭代。 See the IO Tools docs for more information on iterator and chunksize. 有关迭代器和块大小的更多信息,请参见IO Tools文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM