Correlation doesn't work between categorical variables like country and plan. Cramér's V turns the chi-square statistic of their contingency table into a 0–1 strength of association:
Implement:
contingency(a, b): the table of counts as a 2-D NumPy array, with rows for the sorted unique values of a and columns for those of bchi_square(table): with cramers_v(a, b): 0.0 if either variable has a single categoryassociation_matrix(df, columns): a symmetric DataFrame of pairwise V values (1.0 on the diagonal)