0

In Scipy documentation, it clearly says for using statistics(especially for a short description of an array):

Import scipy
scipy.stats.describe(a, axis=0, ddof=1, bias=True, nan_policy='propagate')

But I get the AttributeError: module 'scipy' has no attribute 'stats'

then in another part of the documentation, it says :

from scipy import stats

which works fine for me. Actually, I don't get the exact difference between . and from ...... import ...... and why the first one doesn't work. Thank you so much for your help. I would appreciate it if you guys can provide me some links too.

philoez98
  • 493
  • 4
  • 13
  • I'll just add that I don't know why it doesn't work for you, but both statements work for me. Maybe post your version of scipy? – Gabe Jun 13 '19 at 17:16
  • Thanks for the reply. the version of scipy is 0.19.1 – Mohammadreza Niknam Hamidabad Jun 13 '19 at 17:19
  • The `stats` module must be explicity imported before using it. Replace `import scipy` with `import scipy.stats`. Then you can write `scipy.stats.describe(a, axis=0, ddof=1, bias=True, nan_policy='propagate')`. I'd make that an answer, but this question is a duplicate (it is a SciPy FAQ). – Warren Weckesser Jun 13 '19 at 17:40
  • Oh thanks, I got it. So is it correct to say the stats is a subpackage of scipy? – Mohammadreza Niknam Hamidabad Jun 13 '19 at 17:55
  • That's what I've always called it, and so has SciPy: https://docs.scipy.org/doc/scipy/reference/tutorial/general.html#scipy-organization – Warren Weckesser Jun 13 '19 at 18:03
  • Possible duplicate of [AttributeError: 'module' object (scipy) has no attribute 'misc'](https://stackoverflow.com/questions/13581593/attributeerror-module-object-scipy-has-no-attribute-misc) – ev-br Jun 14 '19 at 14:04

0 Answers0