Kaggle competition: Bike Sharing Demand
prediction_CC = model.predict(train_CC_daily)
 prediction_F = model.predict(train_F_daily )<concatenate>
train = pd.read_csv(".. /input/train.csv", parse_dates = ["datetime"])
 test = pd.read_csv(".. /input/test.csv", parse_dates = ["datetime"] )
last_case = train_features_CC[0][-1] + abs(round(prediction_CC[0][0]))
np.append(train_features_CC[0], last_case)
 train_features_CC[0]<feature_engineering>
train["year"] = train["datetime"].dt.year
train["hour"] = train["datetime"].dt.hour
train["dayofweek"] = train["datetime"].dt.dayofweek
test["year"] = test["datetime"].dt.year
test["hour"] = test["datetime"].dt.hour
test["dayofweek"] = test["datetime"].dt.dayofweek
for index in range(len(prediction_CC)) :
for inner_index in range(len(prediction_CC[index])) :
if prediction_CC[index][inner_index] >= 0:
prediction_CC[index][inner_index] = round(prediction_CC[index][inner_index])
 elif prediction_CC[index][inner_index] < 0:
prediction_CC[index][inner_index] = round(abs(prediction_CC[index][inner_index]))<feature_engineering>
train.drop(["datetime","casual","registered","windspeed"],1,inplace=True )
for index in range(len(prediction_F)) :
for inner_index in range(len(prediction_F[index])) :
if prediction_F[index][inner_index] >= 0:
prediction_F[index][inner_index] = round(prediction_F[index][inner_index])
 elif prediction_F[index][inner_index] < 0:
prediction_F[index][inner_index] = round(abs(prediction_F[index][inner_index]))<feature_engineering>
test.drop(["datetime","windspeed"],1,inplace=True )
for index in range(len(prediction_CC)) :
prediction_CC[index][0] = last_day_CC[index]
for inner_index in range(1, len(prediction_CC[index])) :
prediction_CC[index][inner_index] = prediction_CC[index][inner_index] + prediction_CC[index][inner_index-1]
prediction_CC<feature_engineering>
y= train["count"]
for index in range(len(prediction_F)) :
prediction_F[index][0] = last_day_F[index]
for inner_index in range(1, len(prediction_F[index])) :
prediction_F[index][inner_index] = prediction_F[index][inner_index] + prediction_F[index][inner_index-1]
prediction_F<split>
train.drop(["count"],1,inplace=True )
target_CC = CC_dataset.iloc[:,-12:]
target_CC = np.array(target_CC )<prepare_x_and_y>
y_log = np.log1p(y )
target_F = Fatal_dataset.iloc[:,-12:]
target_F = np.array(target_F)
 target_F<concatenate>
rf = RandomForestRegressor(n_estimators=100 )
confirmed_cases = np.concatenate(( target_CC, prediction_CC), axis = 1)
 fatalities = np.concatenate(( target_F, prediction_F), axis = 1 )<load_from_csv>
rf.fit(train,y_log )
submitted_data = pd.read_csv("/kaggle/input/covid19-global-forecasting-week-1/submission.csv" )<prepare_output>
preds = rf.predict(test )
submitted_data['Fatalities'] = fatalities
submitted_data['ConfirmedCases'] = confirmed_cases<save_to_csv>
submission=pd.read_csv(".. /input/sampleSubmission.csv" )
submitted_data.to_csv('submission.csv', index = False, encoding = 'utf-8-sig' )<import_modules>
submission["count"] = np.expm1(preds )
import matplotlib.pylab as plt
import numpy as np
import pandas as pd
import seaborn as sns<load_from_csv>
submission.to_csv("onlywind0ornot.csv", index=False )