gpt4 book ai didi

R:是否可以将 2000 万多行 CSV 的读取并行化/加速到 R 中?

转载 作者:行者123 更新时间:2023-12-04 06:07:36 25 4
gpt4 key购买 nike

通过 read.csv 加载 CSV 后,使用 multicore 相当简单, segue等来处理 CSV 中的数据。然而,阅读它是相当耗时的。

意识到最好使用 mySQL 等。

假设使用运行 R2.13 的 AWS 8xl 集群计算实例

规范如下:

Cluster Compute Eight Extra Large specifications:
88 EC2 Compute Units (Eight-core 2 x Intel Xeon)
60.5 GB of memory
3370 GB of instance storage
64-bit platform
I/O Performance: Very High (10 Gigabit Ethernet)

任何想法/想法都非常感谢。

最佳答案

如果您使用 fread,可能不需要并行在 data.table .

library(data.table)
dt <- fread("myFile.csv")

对此的评论 question说明了它的威力。另外这里有一个来自我自己的经验的例子:
d1 <- fread('Tr1PointData_ByTime_new.csv')
Read 1048575 rows and 5 (of 5) columns from 0.043 GB file in 00:00:09

我能够在 10 秒内阅读 104 万行!

关于R:是否可以将 2000 万多行 CSV 的读取并行化/加速到 R 中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9060457/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com