I am trying to save a csv file with pandas but keep getting this error with this code:
submission = pd.DataFrame({
"PassengerId": test_data["PassengerId"],
"Survived": y_pred })
submission.to_csv(r"C:\Users\thoma\OneDrive\Bureau", index=False)
---------------------------------------------------------------------------
PermissionError Traceback (most recent call last)
<ipython-input-15-1b9e56f25017> in <module>
4 "Survived": y_pred })
5
----> 6 submission.to_csv(r"C:\Users\thoma\OneDrive\Bureau", index=False)
~\Anaconda3\lib\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, tupleize_cols, date_format, doublequote, escapechar, decimal)
3018 doublequote=doublequote,
3019 escapechar=escapechar, decimal=decimal)
-> 3020 formatter.save()
3021
3022 if path_or_buf is None:
~\Anaconda3\lib\site-packages\pandas\io\formats\csvs.py in save(self)
155 f, handles = _get_handle(self.path_or_buf, self.mode,
156 encoding=self.encoding,
--> 157 compression=self.compression)
158 close = True
159
~\Anaconda3\lib\site-packages\pandas\io\common.py in _get_handle(path_or_buf, mode, encoding, compression, memory_map, is_text)
422 elif encoding:
423 # Python 3 and encoding
--> 424 f = open(path_or_buf, mode, encoding=encoding, newline="")
425 elif is_text:
426 # Python 3 and no explicit encoding
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\thoma\\OneDrive\\Bureau'
I am just starting learning Python: does anyone have any idea? I am running Windows as Administrator.