2
팬더 데이터 프레임이 주어지면, 필자는 하나의 컬럼을 기준으로 아웃 라이어 (Z 값 = 3)에 해당하는 행을 제외하고자합니다.팬더 데이터 프레임 - 아웃 라이어 제거
dff=df[(np.abs(stats.zscore(df)) < 3).all(axis='_source.price')]
다음 예외가 발생 :
-------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-68-02fb15620e33> in <module>()
----> 1 dff=df[(np.abs(stats.zscore(df)) < 3).all(axis='_source.price')]
/opt/anaconda3/lib/python3.6/site-packages/scipy/stats/stats.py in zscore(a, axis, ddof)
2239 """
2240 a = np.asanyarray(a)
-> 2241 mns = a.mean(axis=axis)
2242 sstd = a.std(axis=axis, ddof=ddof)
2243 if axis and mns.ndim < a.ndim:
/opt/anaconda3/lib/python3.6/site-packages/numpy/core/_methods.py in _mean(a, axis, dtype, out, keepdims)
68 is_float16_result = True
69
---> 70 ret = umr_sum(arr, axis, dtype, out, keepdims)
71 if isinstance(ret, mu.ndarray):
72 ret = um.true_divide(
TypeError: unsupported operand type(s) for +: 'NoneType' and 'NoneType'
그리고
의 반환 값 라인의 경우df.dtypes
_id object
_index object
_score object
_source.address object
_source.district object
_source.price float64
_source.roomCount float64
_source.size float64
_type object
sort object
priceSquareMeter float64
dtype: object
:
dataframe은 다음과 같습니다 10
는
True
내가 위의 예외를 이유는 무엇입니까
, 그리고 내가 어떻게 이상 값을 제외 할 수 있습니까?