What does it mean to have 1 degree of freedom in ANOVA test?
Well having datasets handy would have made it easier to do it myself and explain better.

But let me try to help you get started assuming you are asking to interpret the results rather than trying to solve model/platform/library specific implementation, if not don't bother reading ahead.



As I understood its the linear fitting model here which you are calling with 2-way ANOVA test.So in Linear models each independent variable uses 1 degree of freedom, if there are 6 then 6 DF. Rest are just actually number of observations available which it shows in residual/error. That's why the sum_sq and mean_sq values are same in your output for variables but different for residual.

I found it much more easier to try 2-Way ANOVA  in excel first and trying to interpret the results. please try this link with excellent explanation I found long back-

https://statisticsbyjim.com/anova/two-way-anova-excel/

https://statisticsbyjim.com/hypothesis-testing/degrees-freedom-statistics/

Few more links which clearly explains-

https://support.minitab.com/en-us/minitab-express/1/help-and-how-to/modeling-statistics/anova/how-to/two-way-anova/methods-and-formulas/methods-and-formulas/

https://www.graphpad.com/support/faq/the-anova-table-ss-and-df-in-two-way-anova/

https://people.richland.edu/james/ictcm/2004/twoway.html

And If you are statistically challenged like me and have to brush up to use it effectively in ML, please follow these-

https://www.youtube.com/watch?v=NF5_btOaCig