3주차(4) : Multivariable Linear Regression 실습
import pandas as pd
data = pd.read_csv('bike_train.csv')
data[:10]
datetime_series = data['datetime']
data['year'] = pd.to_datetime(datetime_series).dt.year
data['month'] = pd.to_datetime(datetime_series).dt.month
data['day'] = pd.to_datetime(datetime_series).dt.day
data['hour'] = pd.to_datetime(datetime_series).dt.hour
data.to_csv('bike_new.csv', index=False)
data[:10]
X = data.drop(['datetime', 'count'], axis=1)
y = data['count']
from sklearn import linear_model
H = linear_model.LinearRegression()
H.fit(X, y)
print(list(X.columns))
print(H.coef_)
print(H.intercept_)