看板 Python 關於我們 聯絡資訊
大家好 我很不會用Python 但是大學專題需要我用到 所以我問了學長姐跟他們拿了檔案 想說可以學習看看 所以我就一步一步逐段打 但殊不知一開始就遇到了問題 以下是我的程式碼 第一段 import pandas as pd from bokeh.io import output_file, show from bokeh.plotting import * import numpy as np 第二段 text1=pd.read_excel("map1.xlsx") 結果就跑出 IOError Traceback (most recent call last) <ipython-input-6-b13e7578b335> in <module>() ----> 1 text1=pd.read_excel("map1.xlsx") C:\Anaconda2\lib\site-packages\pandas\io\excel.pyc in read_excel(io, sheetname, header, skiprows, skip_footer, index_col, parse_cols, parse_dates, date_parser, na_values, thousands, convert_float, has_index_names, converters, engine, **kwds) 161 162 if not isinstance(io, ExcelFile): --> 163 io = ExcelFile(io, engine=engine) 164 165 return io._parse_excel( C:\Anaconda2\lib\site-packages\pandas\io\excel.pyc in __init__(self, io, **kwds) 204 self.book = xlrd.open_workbook(file_contents=data) 205 else: --> 206 self.book = xlrd.open_workbook(io) 207 elif engine == 'xlrd' and isinstance(io, xlrd.Book): 208 self.book = io C:\Anaconda2\lib\site-packages\xlrd\__init__.py in open_workbook(filename, logfile, verbosity, use_mmap, file_contents, encoding_override, formatting_info, on_demand, ragged_rows) 392 peek = file_contents[:peeksz] 393 else: --> 394 f = open(filename, "rb") 395 peek = f.read(peeksz) 396 f.close() IOError: [Errno 2] No such file or directory: 'map1.xlsx' 不知道是我的excel檔放錯地方還是哪裡有問題呢 希望各位前輩可以指導我謝謝 ----- Sent from JPTT on my HTC One 801e. -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 115.82.146.94 ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1478249449.A.00C.html
infit: 路徑錯誤 11/04 16:53
wergbm501: 那我應該要放在哪裡呀 我有試著放在我的使用者下面 仍 11/04 17:15
wergbm501: 然無法QQ 11/04 17:15
infit: 終端機打pwd 11/04 17:50
wergbm501: 哇可以 我打了pwd顯示是桌面 所以我就把東西都拖到桌面 11/04 18:39
wergbm501: 果然可以 11/04 18:39
wergbm501: 謝謝大家 11/04 18:39