Filtruj wszystkie kolumny w pandy

In[1]:
import pandas as pd
import numpy as np

df = pd.DataFrame(np.random.rand(10,5))  
corr = df.corr()
corr.shape

Out[1]: (5, 5)
  
###################  

In [2]: corr_triu = corr.where(~np.tril(np.ones(corr.shape)).astype(np.bool))
         corr_triu
Out[2]: 
    0         1         2         3         4
0 NaN  0.228763 -0.276406  0.286771 -0.050825
1 NaN       NaN -0.562459 -0.596057  0.540656
2 NaN       NaN       NaN  0.402752  0.042400
3 NaN       NaN       NaN       NaN -0.642285
4 NaN       NaN       NaN       NaN       NaN

##################

In [3]: corr_triu = corr_triu.stack()
        corr_triu[corr_triu > 0.3]
Out[3]: 
1  4    0.540656
2  3    0.402752
dtype: float64
hanux