This repository was archived by the owner on Sep 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvehicle_fuels.py
More file actions
44 lines (34 loc) · 1.41 KB
/
vehicle_fuels.py
File metadata and controls
44 lines (34 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import pandas as pd
import pathlib
from pandas.io import json
# + tags=["parameters"]
upstream = None
product = {"nb": "output/pdo.ipynb", "data": "output/pdo.csv"}
# -
#Vehicle fuels
#User input for the fuels values in litres
petrol_litres = int(input("Enter the value of petrol in litres"))
diesel_litres = int(input("Enter the value of diesel in litres"))
gasoil_litres = int(input("Enter the value of gasoil in litres"))
vf_litres = [petrol_litres, diesel_litres, gasoil_litres]
column_names = ['fuels', 'litres']
vehicles_fuels = ['Petrol', 'Diesel', 'Gasoil']
list_tuples = list(zip(vehicles_fuels, vf_litres))
#Conversion Factors [petrol, diesel, gasoil]
###multiplied per litre
tfc_convf = [9.348, 10.130, 10.130]
euro_convf = [1.24, 1.05, 0.56]
###multiplied per tfc
tper_convf = [1.1, 1.1, 1.1]
co2_convf = [0.252, 0.264, 0.264]
##build dataframe
vehicles_df = pd.DataFrame(list_tuples, columns= column_names)
#vehicles_df['TFC_Conversion_factor'] = tfc_convf
vehicles_df['TFC(kwh)'] = vehicles_df['litres'] * tfc_convf
#vehicles_df['TPER_Conversion_factor'] = tper_convf
vehicles_df['TPER(kwh)'] = vehicles_df['TFC(kwh)'] * tper_convf
#vehicles_df['CO2_Conversion_factor'] = co2_convf
vehicles_df['CO2(kg)'] = vehicles_df['TFC(kwh)'] * co2_convf
#vehicles_df['Euro_Conversion_factor'] = euro_convf
vehicles_df['Euros'] = vehicles_df['litres'] * euro_convf
vehicles_df.append(vehicles_df.sum(numeric_only=True).rename('Total'))