0

I trying a simple linear regression using ols and it fails at columns with multiple word name.

mod = smf.ols(formula='Sales ~ Sub Region + Customer Segment', data=df)

I am searching how to fix but none has worked so far. The Q transformation I found hereas I use it below dsnt resolve it either. Does anyone know how can get this fixed?

mod = smf.ols(formula='Sales ~ Q(Sub Region) + Q(Customer Segment)', data=df)
baharak Al
  • 71
  • 1
  • 10
  • https://stackoverflow.com/questions/38149482/using-ols-function-with-parameters-that-contain-numbers-spaces should solve your problem – Paul Brennan Dec 29 '20 at 21:16
  • 1
    Q transformation works. I only needed a double quote. This worked:mod = smf.ols(formula='Sales ~ Q("Sub Region") + Q("Customer Segment")', data=df) – baharak Al Dec 30 '20 at 16:48

0 Answers0