I would like to generate a DataFrame similar to corr(), but with a different formulation.
For example, suppose I have a DataFrame
import pandas as pd
pa = pd.DataFrame()
pa['john']=[2,3,4,5,6]
pa['june']=[4,6,7,8,2]
pa['kate']=[3,2,3,4,5]
Pandas has the corr() build-in function that generates a new correlation DataFrame. So if I call pa.corr() is returns me
john june kate
john 1.000000 -0.131306 0.832050
june -0.131306 1.000000 -0.437014
kate 0.832050 -0.437014 1.000000
I want to generate a new DataFrame like that, but with different formulation, for example,
john june kate
john formula(john)*formula(john) formula(june)*formula(john) formula(kate)*formula(john)
june formula(john)*formula(june) formula(june)*formula(june) formula(kate)*formula(june)
kate formula(john)*formula(kate) formula(june)*formula(kate) formula(kate)*formula(kate)
where formula() calculates over one DataFrame column (could be, eg, formula(pa['john']) How can I do it?