Unable to use scipy.stats

I get errr when using scipy.stats. in the script after importing scipy.

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

In the script editor, I can click on the statistics after entering scipy. from the drop-down menu, in the python console I cannot select python.stats from the drop-down menu, it is not. I use pandas 2.7 and SciPy 0.13.0 Why is this? Any known issues?

+6
source share
1 answer

expanding my comment (for an answer).

Scipy, like many other large packages, does not import all modules automatically. If we want to use scipy subpackages, we need to import them directly.

However, some scipy subpackages load other scipy subpackages, therefore, for example, importing scipy.stats also imports a large number of other packages. But I never rely on this to have access to a subpackage in the namespace.

In many packages using scipy, the preferred template is to import subpackages so that they are accessible by their names, for example:

 >>> from scipy import stats, optimize, interpolate >>> import scipy >>> scipy.stats Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'module' object has no attribute 'stats' >>> scipy.optimize Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'module' object has no attribute 'optimize' >>> import scipy.stats >>> scipy.optimize <module 'scipy.optimize' from 'C:\Python26\lib\site-packages\scipy\optimize\__init__.pyc'> 
+7
source

All Articles