numpy.ma.corrcoef#
- ma.corrcoef(x,y=None,rowvar=True,bias=<novalue>,allow_masked=True,ddof=<novalue>)[source]#
Return Pearson product-moment correlation coefficients.
Except for the handling of missing data this function does the same as
numpy.corrcoef. For more details and examples, seenumpy.corrcoef.- Parameters:
- xarray_like
A 1-D or 2-D array containing multiple variables and observations.Each row ofx represents a variable, and each column a singleobservation of all those variables. Also seerowvar below.
- yarray_like, optional
An additional set of variables and observations.y has the sameshape asx.
- rowvarbool, optional
Ifrowvar is True (default), then each row represents avariable, with observations in the columns. Otherwise, the relationshipis transposed: each column represents a variable, while the rowscontain observations.
- bias_NoValue, optional
Has no effect, do not use.
Deprecated since version 1.10.0.
- allow_maskedbool, optional
If True, masked values are propagated pair-wise: if a value is maskedinx, the corresponding value is masked iny.If False, raises an exception. Becausebias is deprecated, thisargument needs to be treated as keyword only to avoid a warning.
- ddof_NoValue, optional
Has no effect, do not use.
Deprecated since version 1.10.0.
See also
numpy.corrcoefEquivalent function in top-level NumPy module.
covEstimate the covariance matrix.
Notes
This function accepts but discards argumentsbias andddof. This isfor backwards compatibility with previous versions of this function. Thesearguments had no effect on the return values of the function and can besafely ignored in this and previous versions of numpy.
Examples
>>>importnumpyasnp>>>x=np.ma.array([[0,1],[1,1]],mask=[0,1,0,1])>>>np.ma.corrcoef(x)masked_array( data=[[--, --], [--, --]], mask=[[ True, True], [ True, True]], fill_value=1e+20, dtype=float64)