Print the standard deviation of Pandas series

PythonPandasServer Side ProgrammingProgramming

Beyond Basic Programming - Intermediate Python

Most Popular

36 Lectures 3 hours

Practical Machine Learning using Python

Best Seller

91 Lectures 23.5 hours

Practical Data Science using Python

22 Lectures 6 hours

In this program, we will find the standard deviation of a Pandas series. Standard deviation is a statistic that measures the dispersion of a dataset relative to its mean and is calculated as the square root of the variance.

Algorithm

Step 1: Define a Pandas series
Step 2: Calculate the standard deviation of the series using the std() function in the pandas library.
Step 3: Print the standard deviation.

Example Code

import pandas as pd

series = pd.Series([10,20,30,40,50])
print("Series: \n", series)

series_std = series.std()
print("Standard Deviation of the series: ",series.std())

Output

Series:
0    10
1    20
2    30
3    40
4    50
dtype: int64
Standard Deviation of the series:  15.811388300841896
Updated on 16-Mar-2021 10:48:04