Comments (16)
第一步成功运行,但是运行第二步时候(python task/zh_get_daily.py)又出现了新的错误
File "task..\tools\util\analysis.py", line 90, in
lambda row: is_gap(row['high'], row['low'], row['close'], row['pre_high'], row['pre_low'], row['pre_close']),
IndexError: only integers, slices (:
), ellipsis (...
), numpy.newaxis (None
) and integer or boolean arrays are valid indices
from market-breadth.
第一步成功运行,但是运行第二步时候(python task/zh_get_daily.py)又出现了新的错误
File "task..\tools\util\analysis.py", line 90, in
lambda row: is_gap(row['high'], row['low'], row['close'], row['pre_high'], row['pre_low'], row['pre_close']),
IndexError: only integers, slices (:
), ellipsis (...
), numpy.newaxis (None
) and integer or boolean arrays are valid indices遇到同样问题,macOS
Processing 第 1 批 【0~40/2342】... [*********************100%***********************] 40 of 40 completed Traceback (most recent call last): File "task/us_get_daily.py", line 65, in <module> df = analysis.stock_analysis(df, 20, 60, 120) File "task/../tools/util/analysis.py", line 148, in stock_analysis data = stock_gap_and_over(data) File "task/../tools/util/analysis.py", line 91, in stock_gap_and_over axis=1, raw=True) File "/usr/local/lib/python3.7/site-packages/pandas/core/frame.py", line 7552, in apply return op.get_result() File "/usr/local/lib/python3.7/site-packages/pandas/core/apply.py", line 178, in get_result return self.apply_raw() File "/usr/local/lib/python3.7/site-packages/pandas/core/apply.py", line 235, in apply_raw result = np.apply_along_axis(wrap_function(self.f), self.axis, self.values) File "<__array_function__ internals>", line 6, in apply_along_axis File "/usr/local/lib/python3.7/site-packages/numpy/lib/shape_base.py", line 379, in apply_along_axis res = asanyarray(func1d(inarr_view[ind0], *args, **kwargs)) File "/usr/local/lib/python3.7/site-packages/pandas/core/apply.py", line 228, in wrapper result = func(*args, **kwargs) File "task/../tools/util/analysis.py", line 90, in <lambda> lambda row: is_gap(row['high'], row['low'], row['close'], row['pre_high'], row['pre_low'], row['pre_close']), IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices
我把analysis.py里面的raw=true改成false可以运行了,不过有些数据(如pe)获取不到,都是返回null。
from market-breadth.
我重新修改了下 tools 的引入方式,你们看一下正常了没
from market-breadth.
可以告知一下启动执行的命令吗?
从rep代码结构来看应该是执行python task/zh_get_info.py
from market-breadth.
对,就是执行上面命令后出错
from market-breadth.
我尝试了一下,不过我遇到了其他的问题,环境太耦合了,不太规范,我放弃了,建议参照代码思路即可
from market-breadth.
there is a missing "init.py" file in tools (package) directory. it is a multi-level package, every level must have a "init.py" file.
To fix the above error, create an empty "init.py" in tools directory.
In tools directory>>>.
$> ls
"init.py" pycache/ mydb/ util/
from market-breadth.
我加上了 tools/init.py
from market-breadth.
已经加了init.py。结果还是一样ModuleNotFoundError: No module named 'tools.mydb'。
不知道是不是mysql版本问题,现在用的是8.0
from market-breadth.
我理解和 mysql 版本没关系的,Windows 的话 用 python .\task\zh_get_daily.py
from market-breadth.
第一步成功运行,但是运行第二步时候(python task/zh_get_daily.py)又出现了新的错误
File "task..\tools\util\analysis.py", line 90, in
lambda row: is_gap(row['high'], row['low'], row['close'], row['pre_high'], row['pre_low'], row['pre_close']),
IndexError: only integers, slices (:
), ellipsis (...
), numpy.newaxis (None
) and integer or boolean arrays are valid indices
遇到同样问题,macOS
Processing 第 1 批 【0~40/2342】...
[*********************100%***********************] 40 of 40 completed
Traceback (most recent call last):
File "task/us_get_daily.py", line 65, in <module>
df = analysis.stock_analysis(df, 20, 60, 120)
File "task/../tools/util/analysis.py", line 148, in stock_analysis
data = stock_gap_and_over(data)
File "task/../tools/util/analysis.py", line 91, in stock_gap_and_over
axis=1, raw=True)
File "/usr/local/lib/python3.7/site-packages/pandas/core/frame.py", line 7552, in apply
return op.get_result()
File "/usr/local/lib/python3.7/site-packages/pandas/core/apply.py", line 178, in get_result
return self.apply_raw()
File "/usr/local/lib/python3.7/site-packages/pandas/core/apply.py", line 235, in apply_raw
result = np.apply_along_axis(wrap_function(self.f), self.axis, self.values)
File "<__array_function__ internals>", line 6, in apply_along_axis
File "/usr/local/lib/python3.7/site-packages/numpy/lib/shape_base.py", line 379, in apply_along_axis
res = asanyarray(func1d(inarr_view[ind0], *args, **kwargs))
File "/usr/local/lib/python3.7/site-packages/pandas/core/apply.py", line 228, in wrapper
result = func(*args, **kwargs)
File "task/../tools/util/analysis.py", line 90, in <lambda>
lambda row: is_gap(row['high'], row['low'], row['close'], row['pre_high'], row['pre_low'], row['pre_close']),
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices
from market-breadth.
Same here now.
- python task/us_get_info.py works.
- python task/us_get_daily.py >> error >
TRUNCATE TABLE us_stocks_d;
=========================================
Processing 第 1 批 【0~40/2342】...
[100%**] 40 of 40 completed
Traceback (most recent call last):
File "task/us_get_daily.py", line 65, in
df = analysis.stock_analysis(df, 20, 60, 120)
File "/Users/jchang/gh/python/leilone/market-breadth-main/tools/util/analysis.py", line 148, in stock_analysis
data = stock_gap_and_over(data)
File "/Users/jchang/gh/python/leilone/market-breadth-main/tools/util/analysis.py", line 91, in stock_gap_and_over
axis=1, raw=True)
File "/Users/jchang/gh/python/leilone/lib/python3.7/site-packages/pandas/core/frame.py", line 7548, in apply
return op.get_result()
File "/Users/jchang/gh/python/leilone/lib/python3.7/site-packages/pandas/core/apply.py", line 178, in get_result
return self.apply_raw()
File "/Users/jchang/gh/python/leilone/lib/python3.7/site-packages/pandas/core/apply.py", line 235, in apply_raw
result = np.apply_along_axis(wrap_function(self.f), self.axis, self.values)
File "<array_function internals>", line 6, in apply_along_axis
File "/Users/jchang/gh/python/leilone/lib/python3.7/site-packages/numpy/lib/shape_base.py", line 379, in apply_along_axis
res = asanyarray(func1d(inarr_view[ind0], *args, **kwargs))
File "/Users/jchang/gh/python/leilone/lib/python3.7/site-packages/pandas/core/apply.py", line 228, in wrapper
result = func(*args, **kwargs)
File "/Users/jchang/gh/python/leilone/market-breadth-main/tools/util/analysis.py", line 90, in
lambda row: is_gap(row['high'], row['low'], row['close'], row['pre_high'], row['pre_low'], row['pre_close']),
IndexError: only integers, slices (:
), ellipsis (...
), numpy.newaxis (None
) and integer or boolean arrays are valid indices
=================================================
Are some values not "integers" causing this IndexError ?
from market-breadth.
第一步成功运行,但是运行第二步时候(python task/zh_get_daily.py)又出现了新的错误
File "task..\tools\util\analysis.py", line 90, in
lambda row: is_gap(row['high'], row['low'], row['close'], row['pre_high'], row['pre_low'], row['pre_close']),
IndexError: only integers, slices (:
), ellipsis (...
), numpy.newaxis (None
) and integer or boolean arrays are valid indices遇到同样问题,macOS
Processing 第 1 批 【0~40/2342】... [*********************100%***********************] 40 of 40 completed Traceback (most recent call last): File "task/us_get_daily.py", line 65, in <module> df = analysis.stock_analysis(df, 20, 60, 120) File "task/../tools/util/analysis.py", line 148, in stock_analysis data = stock_gap_and_over(data) File "task/../tools/util/analysis.py", line 91, in stock_gap_and_over axis=1, raw=True) File "/usr/local/lib/python3.7/site-packages/pandas/core/frame.py", line 7552, in apply return op.get_result() File "/usr/local/lib/python3.7/site-packages/pandas/core/apply.py", line 178, in get_result return self.apply_raw() File "/usr/local/lib/python3.7/site-packages/pandas/core/apply.py", line 235, in apply_raw result = np.apply_along_axis(wrap_function(self.f), self.axis, self.values) File "<__array_function__ internals>", line 6, in apply_along_axis File "/usr/local/lib/python3.7/site-packages/numpy/lib/shape_base.py", line 379, in apply_along_axis res = asanyarray(func1d(inarr_view[ind0], *args, **kwargs)) File "/usr/local/lib/python3.7/site-packages/pandas/core/apply.py", line 228, in wrapper result = func(*args, **kwargs) File "task/../tools/util/analysis.py", line 90, in <lambda> lambda row: is_gap(row['high'], row['low'], row['close'], row['pre_high'], row['pre_low'], row['pre_close']), IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices
我把analysis.py里面的raw=true改成false可以运行了,不过有些数据(如pe)获取不到,都是返回null。
刚试了一下, 脚本跑成功了。 但是最后分析出来的图表有点看不懂,感觉数据不对
最后的 TOTAL 的值 不应该是 前面所有 Industry value 相加的结果吗? 为啥感觉对不上
更正 TOTAL = average of (industry value1 + industry value2 + .......)
from market-breadth.
@hk-Lei
Request.txt :你跑的MySQL 是版本8 如果是3.X至3.7 。tabbles'的collate 設定值要改為utf8mb4_general_ci.
imgkit: 不只install imgkit, 是不是也要 install wkhtmltoimage on OS from https://wkhtmltopdf.org
ThX
from market-breadth.
- downloaded new updates and run
$> python task/us_get_daily.py
Processing 第 61 批 【2400~2440/2404】...
[100%**] 4 of 4 completed
Download Data use 0:09:21.198070
很好
mysql> SELECT * FROM us_stocks_sector_d ORDER BY date desc ;
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id: 2330
Current database: lei
+------------+------+------+------+------+------+------+------+------+------+------+------+-------+
| date | MAT | COM | CNS | CND | ENE | FIN | HLT | IND | REI | TEC | UTL | TOTAL |
+------------+------+------+------+------+------+------+------+------+------+------+------+-------+
| 2020-11-11 | 89 | 80 | 77 | 75 | 96 | 95 | 84 | 88 | 81 | 82 | 89 | 85 |
| 2020-11-10 | 93 | 76 | 61 | 67 | 96 | 88 | 75 | 88 | 77 | 69 | 93 | 80 |
| 2020-11-09 | 89 | 72 | 42 | 62 | 96 | 88 | 81 | 81 | 65 | 85 | 89 | 77 |
TOTAL: 不對
CNS:77 但是 https://slack-files.com/TKX46TJ4X-F01EJQSD3EE-770862c623 是 75.
from market-breadth.
I got the image below on my Mac OS Cataline 10.15.7 after running python task/us_get_daily.py.
CNS issue is a minor issue. But TOTAL has to be fixed in the script.
python --version
Python 3.7.3
mysql> select @@Version
-> ;
+------------+
| @@Version |
+------------+
| 5.7.32-log |
+------------+
from market-breadth.
Related Issues (17)
- 请问在sql表中是否能增加一个获取股东人数的接口数据?
- 无法运行only integers, slices (`:`), ellipsis (`...`) HOT 1
- us_get_daily: Max retries exceeded HOT 1
- ImportError: attempted relative import with no known parent package HOT 3
- 开发者您好,市场宽度的计算为何需要truncate_table,每次运算都要删库重新计算呢? HOT 2
- pandas版本0.25.3 numpy版本1.20.0,执行us_get_info.py报错:<attribute 'dtype' of 'numpy.generic' objects>
- 请问怎样获取历史数据?
- opendatatools这个包已经失效,如何修复?
- Libertyproject
- usstock.get_symbols() return error, please check the traceback log HOT 4
- 美股市场宽度生成不了。
- us_get_info.py::Line38:: symbols, msg = usstock.get_symbols() does not work HOT 4
- 最终分析结果 图标中的 TOTAL 数值问题 HOT 1
- zh_get_daily.py 报错 HOT 1
- 大佬 pip 下载不成功 TA_Lib- HOT 2
- 国内用户访问不到维基百科有没有代理的方法
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from market-breadth.