[Error]module 'scipy' has no attribute 'stats'

Hyuntae Jung·2022년 4월 7일
0

AttributeError: module 'scipy' has no attribute 'stats'

#회귀선 기울기, 상수항

slope, intercept, _, _, _, = sp.stats.linregress(data.index, data.Close)
print(slope, intercept)
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
C:\Users\Public\Documents\ESTsoft\CreatorTemp/ipykernel_33508/738026083.py in <module>
      2 
      3 #회귀선 기울기, 상수항
----> 4 slope, intercept, _, _, _, = sp.stats.linregress(data.index, data.Close)
      5 print(slope, intercept)

AttributeError: module 'scipy' has no attribute 'stats'

Why?

scipy 패키지는 많은 서브패키지를 가지고 있어 자동으로 서브패키지를 임포트하지 못함

해결

ex)

from scipy import stats, interpolate

0개의 댓글