I have two variables coming from diffrent functions and the first one a is:
<class 'numpy.ndarray'>
(100,)
while the other one b is:
<class 'numpy.ndarray'>
(100, 1)
If I try to correlate them via:
from scipy.stats import pearsonr
p, r= pearsonr(a, b)
I get:
r = max(min(r, 1.0), -1.0)
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
My questions are:
(100,1) is 2d array of rows of length 1 like = [[1],[2],[3],[4]] and second one is 1d array [1, 2, 3, 4 ]
a1 = np.array([[1],[2],[3],[4]])
a2 = np.array([1, 2, 3, 4 ])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With