Pearson r is linear association. Print r and pvalue for units vs rain.
Goal
Correlate two short arrays.
from scipy import stats
units = np.array([12.0, 9, 3, 7, 11])
rain = np.array([80.0, 40, 120, 70, 90])
print(stats.pearsonr(units, rain))from scipy import stats
x = np.arange(8, dtype=float)
print(stats.pearsonr(x, 2 * x + 1))from scipy import stats
print(stats.spearmanr([1, 2, 3, 4], [1, 4, 9, 16]))from scipy import stats
print(np.corrcoef([12, 9, 3], [80, 40, 120]))