我試圖將一個包含2000萬行的資料框架保存為CSV格式,具體操作如下:
我試圖將一個包含2000萬行的資料框架保存為CSV格式。
df_merge.to_csv(' processed.csv')
執行代碼后,我得到了這個錯誤資訊。OSError: [Errno 30] 只讀檔案系統:'processed.csv'
這是什么?
這是什么,我應該如何處理?
注意:該代碼在kaggle上運行。
完整的錯誤資訊:
---------------------------------------------------------------------------
OSError Traceback (most recent call last)
<ipython-input-21-1ba18467b457> in < module>
----> 1 df_merge.to_csv(' processed.csv', sep=')
/opt/conda/lib/python3.7/site-packages/pandas/core/generic. py in to_csv(self, path_or_buf, sep, na_rep, float_format, columns, header, index, index_label, mode, encoding, compression, quoting, quotechar, line_terminator, chunksize, date_format, doublequote, escapechar, decimal, errors, storage_options)
3401 doublequote=doublequote。
3402 escapechar=escapechar,
-> 3403 storage_options=storage_options,
3404 )
3405
/opt/conda/lib/python3.7/site-packages/pandas/io/formats/format. py in to_csv(self, path_or_buf, encoding, sep, columns, index_label, mode, compression, quoting, quotechar, line_terminator, chunksize, date_format, doublequote, escapechar, errors, storage_options)
1081 formatter=self.fmt,
1082 )
-> 1083 csv_formatter.save()
1084
1085 if created_buffer:
/opt/conda/lib/python3.7/site-packages/pandas/io/formats/csvs.py in save(self)
232 errors=self.errors,
233 compression=self.compression,
--> 234 storage_options=self.storage_options。
235 ) as handles:
236
/opt/conda/lib/python3.7/site-packages/pandas/io/common.py in get_handle(path_or_buf, mode, encoding, compression, memory_map, is_text, errors, storage_options)
645 encoding=ioargs.encoding,
646 errors=errors,
--> 647 newline=""/span>,
648 )
649 else:
OSError: [Errno 30] 只讀的檔案系統。' processed.csv'] 只讀檔案系統。
uj5u.com熱心網友回復:
我剛才在Kaggle支持論壇上搜索了你的錯誤資訊后發現這個。你有沒有試著使用'./processed.csv'(相對路徑)?我沒有用過,但顯然Kaggle的作業目錄是/kaggle/working/或者'./'/p>。
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/327683.html
標籤:
