This code throws an exception:
"list index out of range"
at the line marked below.
col_sig_squared = [np.zeros(shape=(1,6), dtype=int)]
def calculate_col_sigma_square(matrix):
mx = np.asarray(matrix)
for(x,y), value in np.ndenumerate(matrix):
if(x > 4):
continue
else:
val = matrix[x][y] - x_bar_col[x]
val = val**2
EXCEPTION-->print col_sig_squared[y]
Why is this a problem? col_sig_squared is an array with indices. Why can't I access it like this. Tried a bunch of things but not sure why this syntax is wrong. I'm new to Python and its intricacies, any help would be appreciated.
Thanks
matrix[x][y]usematrix[x,y]there is a big difference ifxis not a scalar.