To calculate the skewness and kurtosis for a sample data set using python.
It represents the shape of the distribution.
Skewness can be quantified to define the extent to which a distribution differs from a normal distribution.
For calculating skewness by using df.skew() python inbuilt function.
Kurtosis is the measure of thickness or heaviness of the given distribution.
Its actually represents the height of the distribution.
The distribution with kurtosis equal to3 is known as mesokurtic. A random variable which follows normal distribution has kurtosis 3.
If the kurtosis is less than three, the distribution is called as platykurtic. Here,the distribution has shorter and thinner tails than normal distribution.
If the kurtosis is greater than three, the distribution is called as leptykurtic. Here, the distribution has longer and fatter tails than normal distribution.
For calculating kurtosis by using df.kurtosis() python inbuilt function.
#import pandas library
import pandas as pd
#Read the data set
data=pd.read_csv(‘/home/soft27/soft27/Sathish/
Pythonfiles/Employee.csv’)
#creating data frame
df=pd.DataFrame(data)
print(“The value of Skewness is:”)
#calculating the skewness
print(df.skew())
print(“The value of kurtosis is:”)
#calculating the kurtosis
print(df.kurtosis())