Reputation: 263
Suppose I have one dataframe as below and I get the correlation matrix (facor 0 to factor 9). How can I get all different combination of factors' correlation matrix (e. g. three factors as a combination)? Thanks.
import pandas as pd
import numpy as np
rs = np.random.RandomState(0)
df = pd.DataFrame(rs.rand(10, 10))
corr = df.corr()
Upvotes: 2
Views: 391
Reputation: 11
You can use
corr.iloc[[1,2,3], [1,2,3]]
to get the first 3 factor correlations.
Upvotes: 1