我遇到了问题。我正在尝试打开一个csv并放入一个神经网络,但这给了我这个错误:
File "/var/www/test.nl/ai_crypto.py", line 126, in <module>
validation_x, validation_y = preprocess_df(validation_main_df)
File "/var/www/test.nl/ai_crypto.py", line 38, in preprocess_df
df[col] = preprocessing.scale(df[col].values)
File "/usr/local/lib/python2.7/dist-packages/sklearn/preprocessing/data.py", line 145, in scale
dtype=FLOAT_DTYPES, force_all_finite='allow-nan')
File "/usr/local/lib/python2.7/dist-packages/sklearn/utils/validation.py", line 568, in check_array
allow_nan=force_all_finite == 'allow-nan')
File "/usr/local/lib/python2.7/dist-packages/sklearn/utils/validation.py", line 56, in _assert_all_finite
raise ValueError(msg_err.format(type_err, X.dtype))
ValueError: Input contains infinity or a value too large for dtype('float64')
这是我使用的3个csv文件的脚本:
https://vreesie02.stackstorage.com/s/JwJxwOkmAAjahlH https://vreesie02.stackstorage.com/s/2TNGbWkQMpIXYl2 https://vreesie02.stackstorage.com/s/NMgYYrlotN48eTn https://vreesie02.stackstorage.com/s/IWVVuiUc38s9yVv
这不是以下内容的副本:
sklearn error ValueError: Input contains NaN, infinity or a value too large for dtype('float64')
因为我已经检查过遮阳篷并且已经使用了可接受的遮阳篷,但这不能解决我的问题
有人可以帮我解决这个问题吗,我在这个错误中停留了将近2个星期,我无法弄清楚!!
答案 0 :(得分:1)
我已经通过删除值为0的行来解决此问题。CSV文件很少获得0,因此python脚本无法处理这些数字。