'ValueError: shapes (4,166) and (12,12) not aligned: 166 (dim 1) != 12 (dim 0) in Two-Way ANOVA

I have trouble processing data with Two-Way ANOVA

this is my data

enter image description here

and I wanted to check if there's a difference in preference of Genre by country by using Anova.

So this is the code I tried

from statsmodels.formula.api import ols
from statsmodels.stats.anova import anova_lm
from statsmodels.stats.multicomp import pairwise_tukeyhsd
formula = 'Genre ~ C(NA_Sales) + C(JP_Sales) + C(EU_Sales):C(Other_Sales)'

lm = ols(formula, df_genre).fit()
print(anova_lm(lm))

and got this error

ValueError: shapes (4,166) and (12,12) not aligned: 166 (dim 1) != 12 (dim 0)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source