Skewness is a measure of asymmetry of a distribution. Kurtosis describes the peakedness of the distribution.
So this recipe is a short example on How to calculate skewness and kurtosis using pandas. Let's get started.
import pandas as pd import seaborn as sb
Let's pause and look at these imports. Pandas is generally used for performing mathematical operation and preferably over arrays. Seaborn is just used in here to import dataset.
df = sb.load_dataset('tips')
Here we have imported tips dataset from seaborn library.
Now our dataset is ready.
Using skew() and kurt() function we have drawn the skewness and kurtosis of total_bill distribution.
Once we run the above code snippet, we will see:
Results of our calculation can be seen in here.