DESCRIPTION
Dataset Used: PredictionsFor4April2019.csv
Problem Statement: ABC Company has made a model to predict the daily number of units sold of different products
Import Necessary Packages
import pandas as pd
Read Dataset
df = pd.read_csv("PredictionsFor4April2019.csv")
df.head()
Output:
df['error'] = ((df.PredValue - df.ActualValue) ** 2)
df.head()
Output:
RMSE for Country DE
rmse_DE = df[df.Country_code == 'DE']['error'].mean() ** .5
rmse_DE_round = round(rmse_DE,1)
rmse_DE_round
output:
10.9
RMSE for Country AT
rmse_AT = df[df.Country_code == 'AT']['error'].mean() ** .5
rmse_AT_round = round(rmse_AT,1)
rmse_AT_round
Output:
0.6
RMSE for Country PL
rmse_PL = df[df.Country_code == 'PL']['error'].mean() ** .5
rmse_PL_round = round(rmse_PL,1)
rmse_PL_round
Output:
1.3
Writing into the list
list_of_result_values = []
list_of_result_values.append(rmse_DE_round)
list_of_result_values.append(rmse_AT_round)
list_of_result_values.append(rmse_PL_round)
list_of_result_values
Output:
[10.9, 0.6, 1.3]
Save Output Into csv file
file = open('./output/output.csv','a+')
file.write("Question2 Output" +"\n")
file.write(str(list_of_result_values) +"\n")
file.close()
If you need any other Data Science related help then send your requirement details at:
If you have any doubt related to above code then also comment in below comment section or send me your suggestion regarding this.
Comments