TheDeveloperBlog.com

Home | Contact Us

C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML

Pandas Standard Deviation

Pandas Standard Deviation with What is Python Pandas, Reading Multiple Files, Null values, Multiple index, Application, Application Basics, Resampling, Plotting the data, Moving windows functions, Series, Read the file, Data operations, Filter Data etc.

<< Back to PANDAS

Pandas Series.std()

The Pandas std() is defined as a function for calculating the standard deviation of the given set of numbers, DataFrame, column, and rows. In respect to calculate the standard deviation, we need to import the package named "statistics" for the calculation of median.

The standard deviation is normalized by N-1 by default and can be changed using the ddof argument.

Syntax:

Series.std(axis=None, skipna=None, level=None, ddof=1, numeric_only=None, **kwargs)

Parameters:

  • axis: {index (0), columns (1)}
  • skipna: It excludes all the NA/null values. If NA is present in an entire row/column, the result will be NA.
  • level: It counts along with a particular level, and collapsing into a scalar if the axis is a MultiIndex (hierarchical).
  • ddof: Delta Degrees of Freedom. The divisor used in calculations is N - ddof, where N represents the number of elements.
  • numeric_only: boolean, default value None
    It includes only float, int, boolean columns. If it is None, it will attempt to use everything, so use only numeric data.
    It is not implemented for a Series.

Returns:

It returns Series or DataFrame if the level is specified.

Example1:

import pandas as pd
# calculate standard deviation
import numpy as np 
print(np.std([4,7,2,1,6,3]))
print(np.std([6,9,15,2,-17,15,4]))

Output

2.1147629234082532
10.077252622027656

Example2:

import pandas as pd
import numpy as np
 
#Create a DataFrame
info = {
    'Name':['Parker','Smith','John','William'],
   'sub1_Marks':[52,38,42,37],
   'sub2_Marks':[41,35,29,36]} 
data = pd.DataFrame(info)
data
# standard deviation of the dataframe
data.std()

Output

sub1_Marks    6.849574
sub2_Marks    4.924429
dtype: float64 

Next TopicSeries.to_frame()




Related Links:


Related Links

Adjectives Ado Ai Android Angular Antonyms Apache Articles Asp Autocad Automata Aws Azure Basic Binary Bitcoin Blockchain C Cassandra Change Coa Computer Control Cpp Create Creating C-Sharp Cyber Daa Data Dbms Deletion Devops Difference Discrete Es6 Ethical Examples Features Firebase Flutter Fs Git Go Hbase History Hive Hiveql How Html Idioms Insertion Installing Ios Java Joomla Js Kafka Kali Laravel Logical Machine Matlab Matrix Mongodb Mysql One Opencv Oracle Ordering Os Pandas Php Pig Pl Postgresql Powershell Prepositions Program Python React Ruby Scala Selecting Selenium Sentence Seo Sharepoint Software Spellings Spotting Spring Sql Sqlite Sqoop Svn Swift Synonyms Talend Testng Types Uml Unity Vbnet Verbal Webdriver What Wpf