使用pandas加载大CSV文件 [英] Loading big CSV file with pandas

查看:1155
本文介绍了使用pandas加载大CSV文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图加载一个csv文件(大约250 MB)作为dataframe与熊猫。在我第一次尝试,我使用典型的read_csv命令,但我收到一个错误内存。
我尝试了 pandas中的大型持久性DataFrame 中提到的方法,使用chunks:

I am trying to load a csv file (around 250 MB) as dataframe with pandas. In my first try I used the typical read_csv command but I receive an Error memory. I have tried the approach mentioned in Large, persistent DataFrame in pandas using chunks:

x=pd.read_csv('myfile.csv', iterator=True, chunksize=1000)
xx=pd.concat([chunk for chunk in x], ignore_index=True)

尝试连接我收到以下错误:例外:所有传递的对象都是无。实际上我不能访问块

but when I tried to concatenate I received the following error: Exception: "All objects passed were None". In fact I can not access the chunks

我使用winpython 3.3.2.1 32位和pandas 0.11.0

I am using winpython 3.3.2.1 for 32 bits with pandas 0.11.0

推荐答案

我建议你安装64位版本的winpython。那么你应该能够加载一个250 MB的文件没有问题。

I suggest that you install the 64 Bit version of winpython. Then you should be able to load a 250 MB file without problems.

这篇关于使用pandas加载大CSV文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆