I’m trying to save a dataframe containing 20 million rows to a CSV format, with this:
df_merge.to_csv('processed.csv')
After executing the code, I got this error message: OSError: [Errno 30] Read-only file system: 'processed.csv'
What is this and how can I handle it?
NOTE: The code is run on kaggle.
Complete error message:
---------------------------------------------------------------------------
OSError Traceback (most recent call last)
<ipython-input-21-1ba18467b457> in <module>
----> 1 df_merge.to_csv('processed.csv',sep='t')
/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="",
648 )
649 else:
OSError: [Errno 30] Read-only file system: 'processed.csv'
Read more here: Source link