recorpy package

Subpackages

Submodules

recorpy.reorder module

recorpy.reorder.ReorderCorr(df, corr_threshold=0.8, corr_method='pearson', order='chain', manual_order=None)
ReorderCorr reorders the columns of a dataframe based on its correlation matrix to analyze clusters better.

It is based on METHODS OF REORDERING THE CORRELATION MATRIX TO FACILITATE VISUAL INSPECTION AND PRELIMINARY CLUSTER ANALYSIS (1973) by John Edward Hunter and de corReorder package by David W. Gerbing (Portland State University; gerbing@pdx.edu)

Parameters
  • df (pandas.DataFrame) – Dataframe with data

  • corr_threshold (float, optional) – Correlation threshold to apply. Defaults to 0.8.

  • corr_method (str, optional) – Correlation method to apply. Defaults to ‘pearson’.

  • order (str, optional) – Order to apply (manual, hclust,chain ). Defaults to ‘chain’.

  • manual_order (list, optional) – List of columns to apply. Defaults to None.

Returns

reordered dataframe

Return type

(pandas.DataFrame)

Example

>>> df = pd.DataFrame(np.random.rand(3,3))
>>> ReorderCorr(df)

Module contents