The df.phik_matrix() returns the correlation matrix with the column names ordered. Pandas keeps the order identical to the input (e.g. df.corr('pearson')).
I would propose to preserve the order as given in the dataframe. It is a simple preprocessing step to sort the columns if desired, for reversing we need to get the mapping from the original dataframe etc. This also allows for easier comparison with correlation matrices produces by pandas.
The
df.phik_matrix()
returns the correlation matrix with the column names ordered. Pandas keeps the order identical to the input (e.g.df.corr('pearson')
).I would propose to preserve the order as given in the dataframe. It is a simple preprocessing step to sort the columns if desired, for reversing we need to get the mapping from the original dataframe etc. This also allows for easier comparison with correlation matrices produces by pandas.