I have a dataframe of values, say:
df = pd.DataFrame(np.array([[0.2, 0.5, 0.3], [0.1, 0.2, 0.5], [0.4, 0.3, 0.3]]),
columns=['a', 'b', 'c'])
in which every row is a vector of probabilities. I want to compute something like the correlation matrix of df.corr() , but instead of correlation, I want to compute the relative entropy.
What is the best way to do this, as I can't find a way to get inside the .corr() method and simply change the function it uses?