Tukey’s test is a post-hoc analysis often employed after performing an analysis of variance (ANOVA). It helps to identify which specific pairs of groups have significant differences in their means.
To perform this test in python, use the below code:
from statsmodels.stats.multicomp import pairwise_tukeyhsd
data_for_tukey = [dataset.loc[dataset.index.year == year, ‘Processing Time’].values for year in years]
flattened_data = np.concatenate(data_for_tukey)
group_labels = np.concatenate([[year] * len(data) for year, data in zip(years, data_for_tukey)])
tukey_results = pairwise_tukeyhsd(flattened_data, group_labels)