Portfolio_Construction
Portfolio_Construction copied to clipboard
self.data.mean() returns a scalar.
Line 27: expected_return_vec = np.transpose(np.mat(self.data.mean()))
If your input data self.data
is a matrix (np.ndarray) then self.data.mean()
returns only a scalar.
You may want to consider self.data.mean(axis=0)
.
Also I suggest you to compare your calculated sample covariance matrix with the output by np.cov()
.