LouisScorpio / datamining

learn in datamining
522 stars 848 forks source link

RuntimeWarning: Mean of empty slice #10

Open neiwell opened 7 years ago

neiwell commented 7 years ago

用的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)

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