text_plain_output_1.png
from sklearn.linear_model import LinearRegression

import numpy as np

import pandas as pd

df = pd.read_csv('../input/raw_lemonade_data.csv')

df['Date'] = pd.to_datetime(df['Date'])
df['Price'] = df.Price.str.replace('$', '').replace(' ', '')
df['Price'] = df.Price.astype(np.float64)
df = df.set_index(df['Date'])
df = df.drop('Date', 1)
df['Revenue'] = df.Price * df.Sales
df = df[['Revenue', 'Temperature', 'Rainfall', 'Flyers']]

X = df[['Flyers']]
y = df[['Revenue']]

flyer_linear_model = LinearRegression().fit(X, y)

print('Coefficient for flyers:', flyer_linear_model.coef_)
print('Linear model coefficients are the weights of the model')