Scipy is a free and open-source python library. It contains a large number of mathematical functions that allows you to do scientific and technical computing in an efficient way. The * scipy.stats* module contains a large number of functions for the probability distribution, summary and frequency statistics, correlation functions, statistical tests e.t.c. If you are getting

*then this post is for you. In this entire tutorial, you will know how to solve the issue of the module ‘scipy’ has no attribute ‘stats’.*

**module ‘scipy’ has no attribute ‘stats’,**## What is the AttributeError?

The attributerError is an error that comes when you are creating attributes or variables for an object. Also, the type of the variable does not support by the attribute method.

Let’s understand through an example. Suppose you are using the python append() method. Instead of passing the list items if you are passing the string then you will get the attribute error. The error comes as the append() method does not support the string variable.

## Why module ‘scipy’ has no attribute ‘stats’ comes?

This type of error mostly comes when you are not properly importing the scipy states module. For example, you are first importing scipy and then importing the stats module.

```
import scipy
scipy.stats
```

**Output**

The other case is you are directly importing the stats module using the below line of code.

`import scipy.stats`

In this case, also you will get the module ‘scipy’ has no attribute ‘stats’

## Solution for module ‘scipy’ has no attribute ‘stats’

The solution for this attributeerror is very simple. Just properly import the stats module. Import the stats module like the below lines of code.

```
import scipy
from scipy import stats
```

You will not get the module ‘scipy’ has no attribute ‘stats’ error.

## Conclusion

Scipy contains a large number of mathematical functions that allows you to calculate probability distributions, statistics, correlation e.t.c. Most of cases this type of attribute error comes when you are not properly importing the stats module. The above solution will solve this issue.

I hope you have liked this tutorial. If you have any queries then you can contact us for more help.

#### Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.