def corr(self, method='<STR_LIT>', min_periods=<NUM_LIT:1>):
numeric_df = self._get_numeric_data()<EOL>cols = numeric_df.columns<EOL>idx = cols.copy()<EOL>mat = numeric_df.values<EOL>if method == '<STR_LIT>':<EOL><INDENT>correl = libalgos.nancorr(ensure_float64(mat), minp=min_periods)<EOL><DEDENT>elif method == '<STR_LIT>':<EOL><INDENT>correl = libalgos.nancorr_spearman(ensure_float64(mat),<EOL>minp=min_periods)<EOL><DEDENT>elif method == '<STR_LIT>' or callable(method):<EOL><INDENT>if min_periods is None:<EOL><INDENT>min_periods = <NUM_LIT:1><EOL><DEDENT>mat = ensure_float64(mat).T<EOL>corrf = nanops.get_corr_func(method)<EOL>K = len(cols)<EOL>correl = np.empty((K, K), dtype=float)<EOL>mask = np.isfinite(mat)<EOL>for i, ac in enumerate(mat):<EOL><INDENT>for j, bc in enumerate(mat):<EOL><INDENT>if i > j:<EOL><INDENT>continue<EOL><DEDENT>valid = mask[i] & mask[j]<EOL>if valid.sum() < min_periods:<EOL><INDENT>c = np.nan<EOL><DEDENT>elif i == j:<EOL><INDENT>c = <NUM_LIT:1.><EOL><DEDENT>elif not valid.all():<EOL><INDENT>c = corrf(ac[valid], bc[valid])<EOL><DEDENT>else:<EOL><INDENT>c = corrf(ac, bc)<EOL><DEDENT>correl[i, j] = c<EOL>correl[j, i] = c<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>".format(method=method))<EOL><DEDENT>return self._constructor(correl, index=idx, columns=cols)<EOL>
Compute pairwise correlation of columns, excluding NA/null values.

Parameters
----------
method : {'pearson', 'kendall', 'spearman'} or callable
    * pearson : standard correlation coefficient
    * kendall : Kendall Tau correlation coefficient
    * spearman : Spearman rank correlation
    * callable: callable with input two 1d ndarrays
        and returning a float. Note that the returned matrix from corr
        will have 1 along the diagonals and will be symmetric
        regardless of the callable's behavior
        .. versionadded:: 0.24.0

min_periods : int, optional
    Minimum number of observations required per pair of columns
    to have a valid result. Currently only available for Pearson
    and Spearman correlation.

Returns
-------
DataFrame
    Correlation matrix.

See Also
--------
DataFrame.corrwith
Series.corr

Examples
--------
>>> def histogram_intersection(a, b):
...     v = np.minimum(a, b).sum().round(decimals=1)
...     return v
>>> df = pd.DataFrame([(.2, .3), (.0, .6), (.6, .0), (.2, .1)],
...                   columns=['dogs', 'cats'])
>>> df.corr(method=histogram_intersection)
      dogs  cats
dogs   1.0   0.3
cats   0.3   1.0