[英]IPython from Ubuntu to Windows UNC Path
我正在Windows 10上通過Anaconda使用IPython 3.4(是的,我知道)。 我使用了在虛擬機上的Ubuntu中用相同版本的IPython編寫的腳本,並嘗試在Windows端運行它。 我一直在嘗試解決Linux中用於文件路徑的“ /”而不是Windows中使用“ \\”的問題。 我嘗試在Windows端簡單地將“ /”的所有實例轉換為“ \\”,但仍然收到以下錯誤:
OSError: [Errno 22] Invalid argument:
C:\\Users\\mike\\Desktop\\S15 NWEA\\Combined_CSVs\\Students_All 2015-08-27 20:12:34.csv'
我希望對此有一個簡單的解決方案。 在那兒?
這是整個錯誤輸出:
OSError Traceback (most recent call last)
<ipython-input-5-b1a80a7377c7> in <module>()
37 Sframe = pd.concat(list,ignore_index=False)
38
---> 39 Sframe.to_csv(str(out_folder)+'\Combined_CSVs\Students_All '+str(st)+'.csv', sep=',')
40 ##Concatenate fields and check for duplicates
41 Sframe["TermSchoolStudent"]=Sframe["TermName"]+Sframe["SchoolName"]+Sframe["StudentID"].map(str)
C:\Users\mike\Anaconda3\lib\site-packages\pandas\core\frame.py in to_csv(self, path_or_buf, sep, na_rep, float_format, columns, header, index, index_label, mode, encoding, quoting, quotechar, line_terminator, chunksize, tupleize_cols, date_format, doublequote, escapechar, decimal, **kwds)
1187 escapechar=escapechar,
1188 decimal=decimal)
-> 1189 formatter.save()
1190
1191 if path_or_buf is None:
C:\Users\mike\Anaconda3\lib\site-packages\pandas\core\format.py in save(self)
1440 else:
1441 f = com._get_handle(self.path_or_buf, self.mode,
-> 1442 encoding=self.encoding)
1443 close = True
1444
C:\Users\mike\Anaconda3\lib\site-packages\pandas\core\common.py in _get_handle(path, mode, encoding, compression)
2827 f = open(path, mode, encoding=encoding)
2828 else:
-> 2829 f = open(path, mode, errors='replace')
2830 else:
2831 f = open(path, mode)
OSError: [Errno 22] Invalid argument:
C:\\Users\\mike\\Desktop\\S15 NWEA\\Combined_CSVs\\Students_All 2015-08-27 20:12:34.csv'
預先感謝邁克爾
問題出在輸出CSV的一部分,名為2015-08-27 20:12:34.csv。 我可以在Linux中使用破折號和冒號來代替文件名,而在Windows中則不能。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.