python

Python 3 Script to Find Mean,Median and Mode Using Numpy and Scipy Module Full Project For Beginners


 

In order to get started you need to install the below library using the pip command as shown below

 

 

pip install numpy

 

pip install scipy

 

 

After installing this library make an app.py file and copy paste the following code

 

 

app.py

 

 

Example

Use the NumPy mean() method to find the average speed:

import numpy

speed = [99,86,87,88,111,86,103,87,94,78,77,85,86]

x = numpy.mean(speed)

print(x)

Example

Use the NumPy median() method to find the middle value:

 

import numpy

speed = [99,86,87,88,111,86,103,87,94,78,77,85,86]

x = numpy.median(speed)

print(x)

Example

Use the SciPy mode() method to find the number that appears the most:

 

from scipy import stats

speed = [99,86,87,88,111,86,103,87,94,78,77,85,86]

x = stats.mode(speed)

print(x)

Similar Posts:

    None Found

Leave a Reply

Your email address will not be published. Required fields are marked *