Reputation: 1
I am working with anaconda and looking for the code for the correlation matrix in pandas.
I look into /pandas/core/frame.py
and found
from pandas._libs import algos as libalgos, lib, properties
several lines after I found:
def corr(self, method="pearson", min_periods=1) -> "DataFrame":
this uses correl
from libalgos
if method == "pearson":
correl = libalgos.nancorr(mat, minp=min_periods)
But when I look in ../pandas/lib/
there is not algos
library.
My question is the libalgos.nacorr
is compiled in C
and where is the code.
Upvotes: 0
Views: 1350
Reputation: 4869
The method you are looking for is in the DataFrame
class. https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.corr.html
DataFrame.corr(method='pearson', min_periods=1)
If you are looking for the actual nancorr source, see here: https://github.com/pandas-dev/pandas/blob/d4cd068ae278d2a37788363df48f687ee1baceba/pandas/_libs/algos.pyx
Upvotes: 1