Dataframe 0.14 Help

corr

Returns DataFrame with the pairwise correlation between two sets of columns.

It computes the Pearson correlation coefficient.

corr { columns1 } .with { columns2 } | .withItself()

To compute pairwise correlation between all columns in the DataFrame use corr without arguments:

corr()

The function is available for numeric- and Boolean columns. Boolean values are converted into 1 for true and 0 for false. All other columns are ignored.

If a ColumnGroup instance is passed as target column for correlation, it will be unpacked into suitable nested columns.

The resulting DataFrame will have n1 rows and n2+1 columns, where n1 and n2 are the number of columns in columns1 and columns2 correspondingly.

The first column will have the name "column" and will contain names of columns in column1. Other columns will have the same names as in columns2 and will contain the computed correlation coefficients.

If exactly one ColumnGroup is passed in columns1, the first column in the output will have its name.

Last modified: 27 September 2024