Hey, I have this set of data:
Date 2022-01-05 -0.012684 -0.011469 -0.013368 -0.004848 2022-01-06 -0.002342 -0.000050 -0.005381 -0.000241 2022-01-07 -0.009285 -0.001326 -0.008862 -0.001013 2022-01-08 0.001059 0.000000 0.000000 0.000000 2022-01-09 0.001064 0.000000 0.000000 0.000000and the following one:
Date
2022-01-05 -0.021065
2022-01-06 -0.000423
2022-01-07 -0.004501
2022-01-10 -0.001295
2022-01-11 0.009867
...
2022-09-27 -0.001411
2022-09-28 0.020688
2022-09-29 -0.021286
2022-09-30 -0.014126
2022-10-03 0.025965
Name: Adj Close, Length: 187, dtype: float64and when running the following regression:(beta, alpha) = stats.linregress(benchmark_ret.values,
port_ret.values)[0:2]I get this error: ValueError Traceback (most recent call last)
<ipython-input-83-5fc43138a81e> in <module>
----> 1 (beta, alpha) = stats.linregress(benchmark_ret.values,
2 port_ret.values)[0:1]
3
4 print("The portfolio beta is", round(beta, 4))
C:\Anaconda3\lib\site-packages\scipy\stats\_stats_mstats_common.py in linregress(x, y)
143 # ssxm = mean( (x-mean(x))^2 )
144 # ssxym = mean( (x-mean(x)) * (y-mean(y)) )
--> 145 ssxm, ssxym, _, ssym = np.cov(x, y, bias=1).flat
146
147 # R-value
C:\Anaconda3\lib\site-packages\numpy\core\overrides.py in cov(*args, **kwargs)
C:\Anaconda3\lib\site-packages\numpy\lib\function_base.py in cov(m, y, rowvar, bias, ddof, fweights, aweights, dtype)
2638 if not rowvar and y.shape[0] != 1:
2639 y = y.T
-> 2640 X = np.concatenate((X, y), axis=0)
2641
2642 if ddof is None:
C:\Anaconda3\lib\site-packages\numpy\core\overrides.py in concatenate(*args, **kwargs)
ValueError: all the input array dimensions except for the concatenation axis must match exactly, but along dimension 1, the array at index 0 has size 187 and the array at index 1 has size 272Actually, I tried with the same matrices dimensions and different values and it worked. Should I concatenate?
