📜  将相关矩阵转换为数据框 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:26.742000             🧑  作者: Mango

代码示例1
correlations = df_no_zeroes_revenue.corr().unstack().sort_values(ascending=False) # Build correlation matrix
correlations = pd.DataFrame(correlations).reset_index() # Convert to dataframe
correlations.columns = ['col1', 'col2', 'correlation'] # Label it
correlations[(corrlations.correlation) > 0.5 & (correlations.correlation < 1)] # to see the highest correlated variables