2
I ran a simple regression to a database with a product (Product, Volume, Price). It ran perfectly. But I would like to run the same regression on a basis with more products, but I want to be able to choose the product I want to run the regression, see:
ex.
Produto | Volume | Preço A A B B
I want to run the regression only on product B.
How to do this?
How to run the regression on all products, however, return separately so that I can analyze them side by side?
Code.
import pandas as pd
Pasta1 = pd.ExcelFile ('Pasta2.xlsx')
Daniel = pd.read_excel (Pasta1, 'Tela')
from scipy.stats import linregress
x= Daniel ['Preço']
y= Daniel ['Volume']
m, b, R, p, SEm = linregress (x, y)
pd.DataFrame ([m , b, R, p, SEm] , columns=['Valores'] , index=['declive',
'ordenada_na_origem', 'coeficiente_de_correlação_(de_Pearson)', 'p-value',
'erro_padrão'])
Upshot:
Valores
declive: 421.398071
ordenada_na_origem: 1432.443189
coeficiente_de_correlação_(de_Pearson): 0.331966
p-value: 0.000003
erro_padrão: 86.869651
Okay Guto... I’ll try.
– Daniel Melo