correlation in python

A forum for general discussion of the Python programming language.

correlation in python

Postby nuncio » Mon Sep 19, 2016 10:04 am

I have two data sets, one,q,with the shape, 25,100,100 and another one,p,with shape -25,1. q is a gridded with 100 x 100 points in the horizontal(x,y), where (xi,yi) represents each grid and 25 is the number of observations at each (xi,yi). I tried both numpy.correlate(p,q) and pearsonr(p,q) but both output error.
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-833-917b57fc9876> in <module>()
----> 1 correl=np.corrcoef(pcs1[:,3],sstano[:,:,:])

/home/nuncio/anaconda2/lib/python2.7/site-packages/numpy/lib/function_base.pyc in corrcoef(x, y, rowvar, bias, ddof)
2143 warnings.warn('bias and ddof have no affect and are deprecated',
2144 DeprecationWarning)
-> 2145 c = cov(x, y, rowvar)
2146 try:
2147 d = diag(c)

/home/nuncio/anaconda2/lib/python2.7/site-packages/numpy/lib/function_base.pyc in cov(m, y, rowvar, bias, ddof, fweights, aweights)
2022 if rowvar == 0 and y.shape[0] != 1:
2023 y = y.T
-> 2024 X = np.vstack((X, y))
2025
2026 if ddof is None:

/home/nuncio/anaconda2/lib/python2.7/site-packages/numpy/core/shape_base.pyc in vstack(tup)
228
229 """
--> 230 return _nx.concatenate([atleast_2d(_m) for _m in tup], 0)
231
232 def hstack(tup):

ValueError: all the input arrays must have same number of dimensions

ANy solutions
THanks
nuncio
Last edited by micseydel on Mon Sep 19, 2016 2:36 pm, edited 1 time in total.
Reason: Initial post lock.
nuncio
 
Posts: 1
Joined: Mon Sep 19, 2016 9:56 am

Return to General Discussions

Who is online

Users browsing this forum: No registered users and 4 guests