Jan-02-2019, 12:54 PM
Hi,
I have correlation matrix as below
my raw data is stored in variable "x"
x:
A B C D
1.2 2.3 5.6 1.0
1.3 5.6 2.3 2.9
5.6 0.7 3.9 2.8
1.3 1.9 2.8 0.8
3.3 0.9 2.8 1.3
4.3 0.6 1.3 2.8
7.3 2.8 0.05 2.8
2.3 2.8 1.03 0.6
How to remove duplicate in reverse order(meaning, just retain A-->B, and omit B-->A)
I have correlation matrix as below
my raw data is stored in variable "x"
x:
A B C D
1.2 2.3 5.6 1.0
1.3 5.6 2.3 2.9
5.6 0.7 3.9 2.8
1.3 1.9 2.8 0.8
3.3 0.9 2.8 1.3
4.3 0.6 1.3 2.8
7.3 2.8 0.05 2.8
2.3 2.8 1.03 0.6
import seaborn as sns f,ax=plt.subplots(figsize=(10,10)) corr=x.corr() sns.heatmap(corr,mask=np.zeros_like(corr,dtype=np.bool),cmap=sns.diverging_palette(220,10,as_cmap=True),square=True,ax,ax) a=x.corr() b=x.corr() corrFilter=x.corr() s=corrFilter.unstack() so=s.sort_values(kind="quicksort")I want to remove diagonal, and only extract upper or lower triangular matrix. I use the below code, but it still retain for example B-->A (But it same as A-->B).
How to remove duplicate in reverse order(meaning, just retain A-->B, and omit B-->A)