[問題] python 2.7讀取excel
大家好
我很不會用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
推
11/04 16:53, , 1F
11/04 16:53, 1F
→
11/04 17:15, , 2F
11/04 17:15, 2F
→
11/04 17:15, , 3F
11/04 17:15, 3F
推
11/04 17:50, , 4F
11/04 17:50, 4F
→
11/04 18:39, , 5F
11/04 18:39, 5F
→
11/04 18:39, , 6F
11/04 18:39, 6F
→
11/04 18:39, , 7F
11/04 18:39, 7F
Python 近期熱門文章
PTT數位生活區 即時熱門文章