FunctionRacerProblemsRace

Slope From a Table

BeginnerstatsmodelsPython

df has columns ads and sales. Fit sales on ads with a statsmodels formula and return the slope: how much sales changes per unit of ads.

Example 1

df {"ads":[0,1,2],"sales":[1,3,5]}
returns 2.0

Sales go up by 2 for each unit of ads.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More statsmodels problems