Slope From a Table
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
3 <= len(df) <= 40- The ads values are not all equal
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More statsmodels problems
- What the Line MissesBeginner
- Echo of YesterdayEasy
- Fair R SquaredEasy
- Group GapsEasy
- Is the Share DifferentEasy
- Is the Slope RealEasy
- Prices for New RowsEasy
- Range for the SlopeEasy