calculate_correlation

calculate_correlation(
    csv_path: str,
    column1: str,
    column2: str,
    method: str = 'pearson'
) -> float

Calculate the correlation between two columns in a CSV file.

Parameters:
NameDescription
csv_pathThe path to the CSV file.

Type: str
column1The name of the first column.

Type: str
column2The name of the second column.

Type: str
methodThe method used to calculate the correlation.

- ‘pearson’ (default): Pearson correlation coefficient.

- ‘kendall’: Kendall Tau correlation coefficient.

- ‘spearman’: Spearman rank correlation coefficient.

- callable: A custom correlation function that takes two arrays and returns a scalar.

Type: str

Default: ‘pearson’
Returns:
TypeDescription
floatfloat: The correlation coefficient between the two columns.