importpandasaspdurl_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,inFile"/usr/local/lib/python3.7/site-packages/pandas/util/_decorators.py",line188,inwrapperreturnfunc(*args,**kwargs)File"/usr/local/lib/python3.7/site-packages/pandas/util/_decorators.py",line188,inwrapperreturnfunc(*args,**kwargs)File"/usr/local/lib/python3.7/site-packages/pandas/io/excel.py",line350,inread_excelio=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,inreads=self._safe_read(self.length)File"/usr/local/lib/python3.7/http/client.py",line610,in_safe_readchunk=self.fp.read(min(amt,MAXAMOUNT))File"/usr/local/lib/python3.7/socket.py",line589,inreadintoreturnself._sock.recv_into(b)File"/usr/local/lib/python3.7/ssl.py",line1049,inrecv_intoreturnself.read(nbytes,buffer)File"/usr/local/lib/python3.7/ssl.py",line908,inreadreturnself._sslobj.read(len,buffer)ConnectionResetError:[Errno104]Connectionresetbypeer有腾讯云的朋友可以测试一下
2 回答
倚天杖
TA贡献1828条经验 获得超3个赞
今天申请了阿里云试用,上面的语句执行,没有任何问题,腾讯云有问题,搞不定。yuminstall-ypython3pip3installpandasxlrd然后测试,阿里云顺利通过。
添加回答
举报
0/150
提交
取消