Lesson 12 of 14
Already have access? Sign in here
Already have access? Sign in here
Ask questions about this lesson and get instant answers.
We will use functions from SciPy package to calculate skew and kurtosis.
1import pandas as pd
2from scipy.stats import skew, kurtosis
3
4# 'stock_data' is a DataFrame containing the 'Simple Returns' column
5
6# Calculate skewness and kurtosis
7skewness = skew(stock_data['Simple Returns'].dropna())
8kurtosis_value = kurtosis(stock_data['Simple Returns'].dropna(), fisher=False)
9
10print(f"Skewness: {skewness}")
11print(f"Kurtosis: {kurtosis_value}")
12Premium membership required
Upgrade to premium to unlock all videos and courses