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

RuntimeWarning: Mean of empty slice #10

Open
neiwell opened this issue Jul 25, 2017 · 0 comments
Open

RuntimeWarning: Mean of empty slice #10

neiwell opened this issue Jul 25, 2017 · 0 comments

Comments

@neiwell
Copy link

neiwell commented Jul 25, 2017

用的tensorflow 1.2.1, 对stock_predict.py进行了一些修改后运行正常。

然而在学习您的stock_predict_2.py时遇到问题了,问题出在第44行。

以下是详细错误信息:
/usr/local/lib/python3.5/dist-packages/numpy/core/fromnumeric.py:2909: RuntimeWarning: Mean of empty slice.
out=out, **kwargs)
/usr/local/lib/python3.5/dist-packages/numpy/core/_methods.py:73: RuntimeWarning: invalid value encountered in true_divide
ret, rcount, out=ret, casting='unsafe', subok=False)
/usr/local/lib/python3.5/dist-packages/numpy/core/_methods.py:135: RuntimeWarning: Degrees of freedom <= 0 for slice
keepdims=keepdims)
/usr/local/lib/python3.5/dist-packages/numpy/core/_methods.py:105: RuntimeWarning: invalid value encountered in true_divide
arrmean, rcount, out=arrmean, casting='unsafe', subok=False)
/usr/local/lib/python3.5/dist-packages/numpy/core/_methods.py:125: RuntimeWarning: invalid value encountered in true_divide
ret, rcount, out=ret, casting='unsafe', subok=False)
/usr/local/lib/python3.5/dist-packages/numpy/lib/function_base.py:1110: RuntimeWarning: Mean of empty slice.
avg = a.mean(axis)
/usr/local/lib/python3.5/dist-packages/numpy/core/_methods.py:80: RuntimeWarning: invalid value encountered in double_scalars
ret = ret.dtype.type(ret / rcount)

在网上搜到一些解决方式,尝试修改为
with warnings.catch_warnings():
warnings.simplefilter("ignore", category=RuntimeWarning)
mean=np.mean(data_test,axis=0)

然而并无法解决问题。
想请教这个问题如何处理?

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

1 participant