agentchat.contrib.captainagent.tools.data_analysis
agentchat.contrib.captainagent.tools.data_analysis.calculate_correlation
calculate_correlation
Calculate the correlation between two columns in a CSV file.
Arguments:
csv_path
str - The path to the CSV file.column1
str - The name of the first column.column2
str - The name of the second column.method
str or callable, optional - The 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.
Returns:
float
- The correlation coefficient between the two columns.