I wanna take array C2, size N,1, and make a array B, size N-1,1.
B[0] = C2[1]
B[1] = C2[2]
and so on. My code is:
import numpy as np
import pandas as pd
fields = "B:D"
data = pd.read_excel(r'C:\Users\file.xlsx', "Sheet2", usecols=fields)
N = 2
# Covariance calculation
C1 = data.cov() C2 = data.var()
B = np.zeros(shape=(N,1))
for i in B:
B[i,1] = C2[i+1,1]
But the error is:
ValueError: Can only tuple-index with a MultiIndex
I know it is a simple mistake, but cant find where :S (new python user)