猿问

为何这个语句无法在腾讯云上运行?

importpandasaspd
url_all="https://sc.hkex.com.hk/TuniS/www.hkex.com.hk/chi/services/trading/securities/securitieslists/ListOfSecurities_c.xlsx"
stocks=pd.read_excel(url_all,skiprows=2,dtype=str)
很简单的三句话,从一个网页,下载股票数据,并读取成一个dataframe.
上面的那三句话在我本机上执行,没有任何问题。
我在腾讯云上,每次执行都有下面的报错:
Traceback(mostrecentcalllast):
File"",line1,in
File"/usr/local/lib/python3.7/site-packages/pandas/util/_decorators.py",line188,inwrapper
returnfunc(*args,**kwargs)
File"/usr/local/lib/python3.7/site-packages/pandas/util/_decorators.py",line188,inwrapper
returnfunc(*args,**kwargs)
File"/usr/local/lib/python3.7/site-packages/pandas/io/excel.py",line350,inread_excel
io=ExcelFile(io,engine=engine)
File"/usr/local/lib/python3.7/site-packages/pandas/io/excel.py",line653,in__init__
self._reader=self._engines[engine](self._io)
File"/usr/local/lib/python3.7/site-packages/pandas/io/excel.py",line421,in__init__
data=filepath_or_buffer.read()
File"/usr/local/lib/python3.7/http/client.py",line460,inread
s=self._safe_read(self.length)
File"/usr/local/lib/python3.7/http/client.py",line610,in_safe_read
chunk=self.fp.read(min(amt,MAXAMOUNT))
File"/usr/local/lib/python3.7/socket.py",line589,inreadinto
returnself._sock.recv_into(b)
File"/usr/local/lib/python3.7/ssl.py",line1049,inrecv_into
returnself.read(nbytes,buffer)
File"/usr/local/lib/python3.7/ssl.py",line908,inread
returnself._sslobj.read(len,buffer)
ConnectionResetError:[Errno104]Connectionresetbypeer
有腾讯云的朋友可以测试一下
RISEBY
浏览 355回答 2
2回答

倚天杖

今天申请了阿里云试用,上面的语句执行,没有任何问题,腾讯云有问题,搞不定。yuminstall-ypython3pip3installpandasxlrd然后测试,阿里云顺利通过。
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答