sns로 악당 음모를 꾸미려고 하는데 다음 오류가 발생합니다.
10 frames
/usr/local/lib/python3.7/dist-packages/numpy/lib/function_base.py in asarray_chkfinite(a, dtype, order)
484 if a.dtype.char in typecodes['AllFloat'] and not np.isfinite(a).all():
485 raise ValueError(
--> 486 "array must not contain infs or NaNs")
487 return a
488
ValueError: array must not contain infs or NaNs
내 데이터를 확인했는데 아무 문제가 없는 것 같습니다. 저도 채워봤습니다.
print(np.isnan(data_n_2).any())
# Output
/usr/local/lib/python3.7/dist-packages/numpy/core/fromnumeric.py:87: RuntimeWarning: overflow encountered in reduce
return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
x False
y False
z False
vx False
vy False
vz False
fx False
fy False
fz False
dtype: bool
이것은 내 code입니다:
data_dia= y
data= X
data_n_2= (data -data.mean()) /(data.std())
data_n_2= data_n_2.fillna(0)
print(np.isnan(data_n_2).any()) # standardization
data= pd.concat([y,data_n_2.iloc[:,0:10]],axis=1)
data= pd.melt(data,id_vars="type",
var_name="features",
value_name='value')
plt.figure(figsize=(10,10))
sns.kdeplot(clean(df['type']), bw=0.1, shade=True, legend=False)
sns.violinplot(x="features", y="value", hue="type", data=data,split=True, inner="quart")
plt.xticks(rotation=90)
이 문제를 어떻게 해결할 수 있습니까? 힌트를 얻을 수 있을까요?
감사합니다
isfinite 로 확인해보니 true 였습니다.
dr meltan2022-01-08 14:15:53문제를 찾으셨다니 다행입니다...
saw2022-01-08 14:20:10어쩌면 당신은 이것을 확인할 수 있습니다.
saw2022-01-08 14:22:00
데이터에서 inf 값을 확인했습니까? np.isfinite(a) 오류 메시지, 484행에서 볼 수 있듯이 일부 유효한 경우(예: inf 값)가 있을 수 있습니다.
saw2022-01-08 14:02:21