Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

求助:qs.ths_index_member(sector)调用该函数抛出错误:ValueError: No tables found?是什么原因,如何解决? #34

Open
h6arry opened this issue Jun 24, 2024 · 2 comments

Comments

@h6arry
Copy link

h6arry commented Jun 24, 2024

import pandas as pd
import qstock as qs

sector_industry_stocks = {}
sector_industry_lists = qs.ths_index_name('行业') #该函数调用正常,获得行业板块有300多个
for sector in sector_industry_lists:
sector_industry_stocks[sector] = qs.ths_index_member(sector) #调用该函数抛出ValueError错误,具体如下:
sector_industry_stocks.head()

错误:
Traceback (most recent call last):
File "C:\Users\84549\Desktop\自己写的策略\强势板块选强势股待上涨趋势短线策略-回测.py", line 25, in
lists = qs.ths_index_member('半导体及元件')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\84549\anaconda3\Lib\site-packages\qstock\data\industry.py", line 45, in ths_index_member
return ths_industry_member(code)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\84549\anaconda3\Lib\site-packages\qstock\data\industry.py", line 125, in ths_industry_member
temp = pd.read_html(res.text)[0]
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\84549\anaconda3\Lib\site-packages\pandas\io\html.py", line 1245, in read_html
return _parse(
^^^^^^^
File "C:\Users\84549\anaconda3\Lib\site-packages\pandas\io\html.py", line 1008, in _parse
raise retained
File "C:\Users\84549\anaconda3\Lib\site-packages\pandas\io\html.py", line 988, in _parse
tables = p.parse_tables()
^^^^^^^^^^^^^^^^
File "C:\Users\84549\anaconda3\Lib\site-packages\pandas\io\html.py", line 248, in parse_tables
tables = self._parse_tables(self._build_doc(), self.match, self.attrs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\84549\anaconda3\Lib\site-packages\pandas\io\html.py", line 603, in _parse_tables
raise ValueError("No tables found")
ValueError: No tables found
请教各位大神,感谢!

@xycode1
Copy link

xycode1 commented Aug 29, 2024

这个框架,获取数据都是免费吗?

@kaykouo
Copy link

kaykouo commented Nov 24, 2024

我也遇到同样的错误,估计同花顺网站的数据位置变了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants