Write a Python program to compute the autocorrelations for first 10 lags of a numeric series


Topic: Write a Python program to compute the autocorrelations for first 10 lags of a numeric series

Solution

import pandas as pd
import numpy as np
ser = pd.Series(np.arange(20) + np.random.normal(1, 10, 20))
autocorrelations = [ser.autocorr(i).round(2) for i in range(11)]
print(autocorrelations[1:])



List all Python Programs