【发布时间】:2013-05-27 15:23:01
【问题描述】:
我习惯了 R,它提供了逐列读取 CSV 文件的快速功能,任何人都可以提出一种 快速 和有效的方法来读取 python 中的大数据(例如 CSV)文件吗?例如 CSV 文件的第 ith 列。
我有以下但需要时间:
import os,csv, numpy, scipy
from numpy import *
f= open('some.csv', 'rb')
reader = csv.reader(f, delimiter=',')
header = reader.next()
zipped = zip(*reader)
print( zipped[0] ) # is the first column
有没有更好的方法在 python 中读取数据(从大文件中)(在内存方面至少和 R 一样快)?
【问题讨论】:
标签: python r python-2.7 csv import-from-csv