导入非常大文件的最佳方法

发布于 2025-02-11 20:48:52 字数 950 浏览 0 评论 0 原文

可以在。它是在页面中间发现的单个文件。我打开了2021文件的ZIP文件,并将CSV重命名为2021,而不是2021.Q1-Q4.Singlefile。我尝试在记事本++中打开它,但说它太大了。另外,不能在Excel中打开它。我尝试以下代码,并在下面获取错误。这个错误告诉我它太大还是无法阅读?还使用命令,read.csv无济于事。有什么建议吗?我想在记事本++中打开它,并保存为2021.txt

  msa2021 <-fread("S:/file_path/2021.csv") 

 Warning in (if (.Platform$OS.type == "unix") system else shell)(paste0("(",  :
'(S:/file_path/2021.csv) > 
 C:\Users\someone\AppData\Local\Temp\3\RtmpqCvyUH\file2eac5c0526dd' execution failed with 
error code 1
Warning in fread("S:file_path/2021.csv") 
 :
 File 'C:\Users\someone\AppData\Local\Temp\3\RtmpqCvyUH\file2eac5c0526dd' has size 0. Returning a NULL data.table.

enter image description here

The data can be found at https://www.bls.gov/cew/downloadable-data-files.htm. It is the single file found in the middle of the page. I opened up the zip file for the 2021 file and renamed the csv to just 2021 instead of 2021.q1-q4.singlefile. I tried opening it in notepad ++ but it says that it is too large. Also, can't open it in excel. I try the following code and get the error below. Is this error telling me that it is too large or can't read it? Also use the command, read.csv to no avail. Any suggestions? I thought of opening it in Notepad ++ and doing a save as 2021.txt

  msa2021 <-fread("S:/file_path/2021.csv") 

 Warning in (if (.Platform$OS.type == "unix") system else shell)(paste0("(",  :
'(S:/file_path/2021.csv) > 
 C:\Users\someone\AppData\Local\Temp\3\RtmpqCvyUH\file2eac5c0526dd' execution failed with 
error code 1
Warning in fread("S:file_path/2021.csv") 
 :
 File 'C:\Users\someone\AppData\Local\Temp\3\RtmpqCvyUH\file2eac5c0526dd' has size 0. Returning a NULL data.table.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

天涯离梦残月幽梦 2025-02-18 20:48:52

从评论转录:

偶尔(太多?)我发现从网络驱动器加载文件的问题(也许从r/python内部阅读)。在这种情况下,尝试从网络驱动器 s:复制到本地 c:驱动器上的某个地方,然后从那里读取。在这种情况下,您的问题与 data.table :: fread 或数据大小无关,只是一个小故障,可以访问网络上的大文件。

Transcribed from comments:

Occasionally (too often?) I find problems loading files from network drives (perhaps more so reading from within R/python). In cases like this, try copying from the network drive S: to somewhere on your local C: drive and read from there. In this case, your problem has nothing to do with data.table::fread or the data size, merely a glitch accessing that large a file on the network.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文