In [20]:
#Importing libraries

import pandas as pd
import matplotlib.pyplot as plt

Importing Datasets¶

In [ ]:
rent = pd.read_csv('NCR Rent Survey.csv')
print('NCR Rent Survey')
rent
In [197]:
cars = pd.read_csv('Car Users Survey.csv')
print('NCR Car Users Survey')
cars
NCR Car Users Survey
Out[197]:
Timestamp First Name Workplace Distance Monthly Consumption (L)
0 10/29/23 16:12 Josef 12 75
1 10/29/23 16:37 Martin 15 100
2 10/29/23 16:45 Francis 22 150
3 10/29/23 18:06 Chito 18 120
4 10/29/23 20:25 Gia 15 100
5 10/29/23 22:44 Nicky 17 110
6 10/29/23 22:55 Anjo 18 120
7 10/30/23 12:18 Marcus 10 70
8 10/30/23 12:31 Rina 25 175
9 10/30/23 12:44 Josh 13 85
10 10/30/23 12:47 Albert 18 120
11 10/30/23 12:49 Gerard 18 120
12 10/30/23 13:05 Odie 15 100
13 10/30/23 13:15 Jason 14 100
14 10/30/23 13:18 Luis 20 130
15 10/30/23 13:21 Raymond 18 120
16 10/30/23 13:24 Marie 15 100
17 10/30/23 13:27 Elmer 10 70
18 10/30/23 13:35 Ruffa 15 100
19 10/30/23 13:50 Alma 12 80
20 10/30/23 14:23 Eddie 10 70
21 10/30/23 14:42 Tommy 15 100
22 10/30/23 15:00 Rolando 17 120
23 10/30/23 15:05 Amery 23 160
24 10/30/23 15:07 Earvin 16 110
25 10/30/23 15:21 Sheena 13 90
26 10/30/23 15:22 Angelica 10 70
27 10/30/23 16:27 Robert 15 100
28 10/30/23 16:53 Dino 30 200
29 10/30/23 17:08 Cyron 24 160
30 10/30/23 19:50 Patrick 21 140
31 10/30/23 20:15 Francheska 14 100
32 10/30/23 21:48 Wendy 18 120
33 10/31/23 9:15 Holly 22 150
34 10/31/23 9:33 Ivan 17 120
35 10/31/23 9:42 Nathan 23 160
36 10/31/23 10:08 Brylle 15 100
37 10/31/23 10:27 Neil 25 170
38 10/31/23 10:36 Zion 16 110
39 10/31/23 11:43 Jacob 14 100
40 10/31/23 11:55 Marissa 18 120
41 10/31/23 12:21 Charles 13 90
42 10/31/23 13:36 Gary 18 120
43 10/31/23 14:12 Bernardo 20 140
44 10/31/23 14:49 Sebastian 21 140
45 10/31/23 15:08 Ella 15 100
46 10/31/23 15:52 Michael 18 120
47 10/31/23 16:19 Julius 25 180
48 10/31/23 16:48 Ariel 28 200
49 10/31/23 17:21 Papa G 30 200
In [87]:
traffic = pd.read_csv('MMDA Dataset.csv')
print('Annual Average Daily Traffic - MMDA')
traffic
Annual Average Daily Traffic - MMDA
Out[87]:
Year Car PUV UV Taxi Pub Truck Trailer MC Tricycle
0 2021 1399242 73766 25805 130855 24693 84738 18477 1421642 18455
1 2022 1563069 100876 33639 125008 23412 74942 20030 1573729 21050
In [61]:
gasprice = pd.read_csv('gasprice.csv')
print('Gasoline Price: 2020-2023')
gasprice
Gasoline Price: 2020-2023
Out[61]:
Date Gasoline Price
0 1-Nov-20 53.6064
1 1-Dec-20 54.1648
2 1-Jan-21 56.9568
3 1-Feb-21 60.3072
4 1-Mar-21 59.1904
5 1-Apr-21 58.6320
6 1-May-21 60.8656
7 1-Jun-21 62.5408
8 1-Jul-21 63.6576
9 1-Aug-21 63.0992
10 1-Sep-21 57.5152
11 1-Oct-21 70.3584
12 1-Nov-21 69.8000
13 1-Dec-21 67.5664
14 1-Jan-22 72.5920
15 1-Feb-22 69.8000
16 1-Mar-22 79.8512
17 1-Apr-22 78.7344
18 1-May-22 86.5520
19 1-Jun-22 86.5520
20 1-Jul-22 75.3840
21 1-Aug-22 73.1504
22 1-Sep-22 63.0992
23 1-Oct-22 64.7744
24 1-Nov-22 68.1248
25 1-Dec-22 63.0992
26 1-Jan-23 69.8000
27 1-Feb-23 69.2416
28 1-Mar-23 63.0992
29 1-Apr-23 64.7744
30 1-May-23 58.6320
31 1-Jun-23 60.3072
32 1-Jul-23 63.6576
33 1-Aug-23 68.1248
34 1-Sep-23 67.5664
35 1-Oct-23 62.5408

Analysis¶

Rent¶

In [203]:
rentcity = rent.groupby('City')
averagerentcity = rentcity['Rent Fee'].mean()
averagerentcity = averagerentcity.sort_values(ascending=False)
In [204]:
fig, ax = plt.subplots()
bars = ax.bar(averagerentcity.index, averagerentcity, color='skyblue', edgecolor='black')

for bar in bars:
    height = bar.get_height()
    ax.text(bar.get_x() + bar.get_width() / 2., height, str(round(height, 0)),
            ha='center', va='top', rotation=90)

plt.title('Average Rent Fee by City')
plt.xlabel('Room Type')
plt.ylabel('Rent Fee')
plt.xticks(rotation=90)

fig.tight_layout()

plt.show()
In [205]:
renttype = rent.groupby('Room Type')
averagerenttype = renttype['Rent Fee'].mean()
In [206]:
fig, ax = plt.subplots()
bars = ax.bar(averagerenttype.index, averagerenttype, color='skyblue', edgecolor='black')

for bar in bars:
    height = bar.get_height()
    ax.text(bar.get_x() + bar.get_width() / 2., height, str(round(height, 0)),
            ha='center', va='bottom')

plt.title('Average Rent Fee by Room Type')
plt.xlabel('Room Type')
plt.ylabel('Rent Fee')

fig.tight_layout()

plt.show()
In [207]:
rent['Commute Cost per Month'] = rent['Commute Cost per Day'] * 21
In [208]:
rent['Variance'] = rent['Commute Cost per Month'] - rent['Rent Fee']
In [209]:
rent
Out[209]:
Timestamp Name City Rent Fee Room Type Commute Cost per Day Commute Cost per Month Variance
0 10/28/23 16:37 James Makati 15000 Condo 700 14700 -300
1 10/28/23 16:37 Marcus Sy Pasig 7000 Apartment 500 10500 3500
2 10/28/23 16:45 Chloe Quezon City 6000 Apartment 300 6300 300
3 10/28/23 18:06 Maryel Makati 4000 Bedspace 300 6300 2300
4 10/28/23 20:25 Eleine Pasay 4500 Bedspace 250 5250 750
5 10/28/23 22:44 Aly Makati 7000 Apartment 350 7350 350
6 10/29/23 17:55 Jose Santos Taguig 9000 Condo 300 6300 -2700
7 10/30/23 12:18 Gemma Taguig 4000 Bedspace 200 4200 200
8 10/30/23 12:31 Ruth Makati 6000 Apartment 250 5250 -750
9 10/30/23 12:44 Anton Quezon City 7500 Condo 300 6300 -1200
10 10/30/23 12:47 Vee Manila 4000 Dorm 200 4200 200
11 10/30/23 12:49 Cookie Palad Mandaluyong 12000 Condo 450 9450 -2550
12 10/30/23 13:05 Joanna Makati 4000 Bedspace 300 6300 2300
13 10/30/23 13:15 Raffy Paranaque 5000 Apartment 250 5250 250
14 10/30/23 13:18 David Mendoza Manila 4500 Dorm 300 6300 1800
15 10/30/23 13:21 Sans Pasay 5500 Apartment 300 6300 800
16 10/30/23 13:24 Antonio Flores Makati 4500 Bedspace 250 5250 750
17 10/30/23 13:27 RC Makati 6000 Apartment 300 6300 300
18 10/30/23 13:35 Pims Taguig 12000 Condo 450 9450 -2550
19 10/30/23 13:50 Elery Mandaluyong 5500 Apartment 200 4200 -1300
20 10/30/23 14:23 Bea Las Pinas 5000 Apartment 350 7350 2350
21 10/30/23 14:42 Geo Deloso Manila 10000 Condo 300 6300 -3700
22 10/30/23 15:00 Ed Bautista San Juan 5000 Apartment 300 6300 1300
23 10/30/23 15:05 Nessy Taguig 12000 Condo 400 8400 -3600
24 10/30/23 15:07 Don Mandaluyong 10000 Condo 300 6300 -3700
25 10/30/23 15:21 Adonis Pasay 4500 Apartment 250 5250 750
26 10/30/23 15:22 Hershie Caloocan 5000 Apartment 200 4200 -800
27 10/30/23 16:27 Jessica Ferrer Taguig 4000 Bedspace 300 6300 2300
28 10/30/23 16:53 Deah Makati 12000 Condo 350 7350 -4650
29 10/30/23 17:08 Marky Manila 3500 Bedspace 200 4200 700
30 10/30/23 19:50 Oliver Pasig 10000 Condo 450 9450 -550
31 10/30/23 20:15 Tina Taguig 4000 Bedspace 300 6300 2300
32 10/30/23 21:48 Marco Lagman Pasay 3500 Bedspace 250 5250 1750
33 10/31/23 18:15 Yeshua Mandaluyong 6000 Apartment 350 7350 1350
34 10/31/23 19:07 Zyra Leah Quezon City 5500 Apartment 300 6300 800
35 10/31/23 19:07 Caren Makati 7000 Apartment 250 5250 -1750
36 10/31/23 19:51 Jasper Go Manila 3500 Bedspace 300 6300 2800
37 11/1/23 8:05 Howell Makati 4000 Bedspace 250 5250 1250
38 11/1/23 11:19 Valerie Quezon City 5500 Apartment 200 4200 -1300
39 11/1/23 20:56 Martin Reyes Taguig 11000 Condo 300 6300 -4700
40 11/2/23 14:06 Penne Makati 10000 Condo 350 7350 -2650
41 11/2/23 23:25 Micah Manila 9000 Condo 300 6300 -2700
42 11/3/23 8:15 Rey Magno Quezon City 6000 Apartment 250 5250 -750
43 11/3/23 8:19 Soy Manila 5500 Apartment 250 5250 -250
44 11/3/23 9:31 Franky San Juan 5000 Apartment 300 6300 1300
45 11/3/23 9:44 Inaki Lim Quezon City 9000 Condo 400 8400 -600
46 11/3/23 11:56 Mel Makati 4500 Bedspace 350 7350 2850
47 11/3/23 13:08 Rob Mojica Quezon City 10000 Condo 300 6300 -3700
48 11/3/23 14:26 Gina Marie Makati 14000 Condo 400 8400 -5600
49 11/3/23 15:19 Joel Taguig 11000 Condo 600 12600 1600
In [224]:
negative_values = rent['Variance'][rent['Variance'] < 0]

negative_value_counts = negative_values.value_counts()

print("Amounts Exceeding Fares")
print(negative_value_counts)
Amounts Exceeding Fares
-3700    3
-750     2
-2550    2
-1300    2
-2700    2
-300     1
-1750    1
-600     1
-250     1
-2650    1
-4700    1
-800     1
-550     1
-4650    1
-3600    1
-1200    1
-5600    1
Name: Variance, dtype: int64
In [220]:
negative_count = (rent['Variance'] < 0).sum()

print(f'Number of renters who pays rent higher than his commute fares: {negative_count}')
Number of renters who pays rent higher than his commute fares: 23
In [225]:
negative_values = rent['Variance'][rent['Variance'] < -2000]

negative_value_counts = negative_values.value_counts()

print("Amounts Exceeding Fares")
print(negative_value_counts)
Amounts Exceeding Fares
-3700    3
-2700    2
-2550    2
-3600    1
-4650    1
-4700    1
-2650    1
-5600    1
Name: Variance, dtype: int64
In [211]:
rent.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 50 entries, 0 to 49
Data columns (total 8 columns):
 #   Column                  Non-Null Count  Dtype 
---  ------                  --------------  ----- 
 0   Timestamp               50 non-null     object
 1   Name                    50 non-null     object
 2   City                    50 non-null     object
 3   Rent Fee                50 non-null     int64 
 4   Room Type               50 non-null     object
 5   Commute Cost per Day    50 non-null     int64 
 6   Commute Cost per Month  50 non-null     int64 
 7   Variance                50 non-null     int64 
dtypes: int64(4), object(4)
memory usage: 3.3+ KB
In [212]:
renttype = rent.groupby('Room Type')
averagerentvar = renttype['Variance'].mean()
In [213]:
fig, ax = plt.subplots()
bars = ax.bar(averagerentvar.index, averagerentvar, color='skyblue', edgecolor='black')

for bar in bars:
    height = bar.get_height()
    ax.text(bar.get_x() + bar.get_width() / 2., height, str(round(height, 0)),
            ha='center', va='bottom')

plt.title('Average Variance by Room Type')
plt.xlabel('Room Type')
plt.ylabel('Fee Variance')

fig.tight_layout()

plt.show()

Car Users¶

In [214]:
cars.describe()
Out[214]:
Workplace Distance Monthly Consumption (L)
count 50.000000 50.000000
mean 17.680000 120.100000
std 4.983401 34.396992
min 10.000000 70.000000
25% 15.000000 100.000000
50% 17.000000 120.000000
75% 20.750000 140.000000
max 30.000000 200.000000
In [215]:
#Use Jan 2024 gasoline price, compute for the  monthlycost

cars['Monthly Cost (Jan 2024)'] = cars['Monthly Consumption (L)'] * 69.7
cars
Out[215]:
Timestamp First Name Workplace Distance Monthly Consumption (L) Monthly Cost (Jan 2024)
0 10/29/23 16:12 Josef 12 75 5227.5
1 10/29/23 16:37 Martin 15 100 6970.0
2 10/29/23 16:45 Francis 22 150 10455.0
3 10/29/23 18:06 Chito 18 120 8364.0
4 10/29/23 20:25 Gia 15 100 6970.0
5 10/29/23 22:44 Nicky 17 110 7667.0
6 10/29/23 22:55 Anjo 18 120 8364.0
7 10/30/23 12:18 Marcus 10 70 4879.0
8 10/30/23 12:31 Rina 25 175 12197.5
9 10/30/23 12:44 Josh 13 85 5924.5
10 10/30/23 12:47 Albert 18 120 8364.0
11 10/30/23 12:49 Gerard 18 120 8364.0
12 10/30/23 13:05 Odie 15 100 6970.0
13 10/30/23 13:15 Jason 14 100 6970.0
14 10/30/23 13:18 Luis 20 130 9061.0
15 10/30/23 13:21 Raymond 18 120 8364.0
16 10/30/23 13:24 Marie 15 100 6970.0
17 10/30/23 13:27 Elmer 10 70 4879.0
18 10/30/23 13:35 Ruffa 15 100 6970.0
19 10/30/23 13:50 Alma 12 80 5576.0
20 10/30/23 14:23 Eddie 10 70 4879.0
21 10/30/23 14:42 Tommy 15 100 6970.0
22 10/30/23 15:00 Rolando 17 120 8364.0
23 10/30/23 15:05 Amery 23 160 11152.0
24 10/30/23 15:07 Earvin 16 110 7667.0
25 10/30/23 15:21 Sheena 13 90 6273.0
26 10/30/23 15:22 Angelica 10 70 4879.0
27 10/30/23 16:27 Robert 15 100 6970.0
28 10/30/23 16:53 Dino 30 200 13940.0
29 10/30/23 17:08 Cyron 24 160 11152.0
30 10/30/23 19:50 Patrick 21 140 9758.0
31 10/30/23 20:15 Francheska 14 100 6970.0
32 10/30/23 21:48 Wendy 18 120 8364.0
33 10/31/23 9:15 Holly 22 150 10455.0
34 10/31/23 9:33 Ivan 17 120 8364.0
35 10/31/23 9:42 Nathan 23 160 11152.0
36 10/31/23 10:08 Brylle 15 100 6970.0
37 10/31/23 10:27 Neil 25 170 11849.0
38 10/31/23 10:36 Zion 16 110 7667.0
39 10/31/23 11:43 Jacob 14 100 6970.0
40 10/31/23 11:55 Marissa 18 120 8364.0
41 10/31/23 12:21 Charles 13 90 6273.0
42 10/31/23 13:36 Gary 18 120 8364.0
43 10/31/23 14:12 Bernardo 20 140 9758.0
44 10/31/23 14:49 Sebastian 21 140 9758.0
45 10/31/23 15:08 Ella 15 100 6970.0
46 10/31/23 15:52 Michael 18 120 8364.0
47 10/31/23 16:19 Julius 25 180 12546.0
48 10/31/23 16:48 Ariel 28 200 13940.0
49 10/31/23 17:21 Papa G 30 200 13940.0
In [216]:
cars.describe()
Out[216]:
Workplace Distance Monthly Consumption (L) Monthly Cost (Jan 2024)
count 50.000000 50.000000 50.000000
mean 17.680000 120.100000 8370.970000
std 4.983401 34.396992 2397.470345
min 10.000000 70.000000 4879.000000
25% 15.000000 100.000000 6970.000000
50% 17.000000 120.000000 8364.000000
75% 20.750000 140.000000 9758.000000
max 30.000000 200.000000 13940.000000
In [217]:
carsfuel = cars.groupby('Monthly Consumption (L)')
carsfuelcost = carsfuel['Monthly Cost (Jan 2024)'].mean()
carsfuelcost = carsfuelcost.sort_values(ascending=False)
In [218]:
carsfuelcost
Out[218]:
Monthly Consumption (L)
200    13940.0
180    12546.0
175    12197.5
170    11849.0
160    11152.0
150    10455.0
140     9758.0
130     9061.0
120     8364.0
110     7667.0
100     6970.0
90      6273.0
85      5924.5
80      5576.0
75      5227.5
70      4879.0
Name: Monthly Cost (Jan 2024), dtype: float64
In [219]:
fig, ax = plt.subplots()
bars = ax.bar(carsfuelcost.index, carsfuelcost, color='skyblue', edgecolor='black')

for bar in bars:
    height = bar.get_height()
    ax.text(bar.get_x() + bar.get_width() / 2., height, str(round(height, 0)),
            ha='right', va='top', rotation=90)

plt.title('Average Fuel Cost by Monthly Consumption')
plt.xlabel('Liters')
plt.ylabel('Fuel Cost')
plt.xticks(rotation=90)

fig.tight_layout()

plt.show()

Gasoline Price (ARIMA)¶

In [62]:
# Convert the date column to datetime type
gasprice['Date'] = pd.to_datetime(gasprice['Date'])

# Plot the time series
plt.figure(figsize=(12, 6))
plt.plot(gasprice['Date'], gasprice['Gasoline Price'], label='Gasoline Price')
plt.title('Gasoline Price Over Time')
plt.xlabel('Date')
plt.ylabel('Gasoline Price')
plt.legend()
plt.show()
In [63]:
from statsmodels.tsa.seasonal import seasonal_decompose

# Decompose the time series
decomposition = seasonal_decompose(gasprice.set_index('Date')['Gasoline Price'], model='additive')

trend = decomposition.trend
seasonal = decomposition.seasonal
residual = decomposition.resid

# Plot the decomposed components
plt.figure(figsize=(12, 8))
plt.subplot(411)
plt.plot(gasprice['Date'], gasprice['Gasoline Price'], label='Original')
plt.legend()
plt.subplot(412)
plt.plot(gasprice['Date'], trend, label='Trend')
plt.legend()
plt.subplot(413)
plt.plot(gasprice['Date'], seasonal, label='Seasonal')
plt.legend()
plt.subplot(414)
plt.plot(gasprice['Date'], residual, label='Residual')
plt.legend()
plt.tight_layout()
plt.show()
In [65]:
from statsmodels.tsa.arima.model import ARIMA

# Fit ARIMA model
model = ARIMA(gasprice['Gasoline Price'], order=(1, 1, 1))  # Set appropriate values for p, d, and q
fitted_model = model.fit()

# Print model summary
print(fitted_model.summary())
                               SARIMAX Results                                
==============================================================================
Dep. Variable:         Gasoline Price   No. Observations:                   36
Model:                 ARIMA(1, 1, 1)   Log Likelihood                -105.515
Date:                Thu, 16 Nov 2023   AIC                            217.031
Time:                        04:43:00   BIC                            221.697
Sample:                             0   HQIC                           218.641
                                 - 36                                         
Covariance Type:                  opg                                         
==============================================================================
                 coef    std err          z      P>|z|      [0.025      0.975]
------------------------------------------------------------------------------
ar.L1         -0.2471      0.731     -0.338      0.735      -1.679       1.185
ma.L1          0.0662      0.698      0.095      0.924      -1.301       1.434
sigma2        24.3027      6.186      3.928      0.000      12.178      36.428
===================================================================================
Ljung-Box (L1) (Q):                   0.00   Jarque-Bera (JB):                 0.28
Prob(Q):                              0.96   Prob(JB):                         0.87
Heteroskedasticity (H):               0.98   Skew:                            -0.18
Prob(H) (two-sided):                  0.98   Kurtosis:                         3.27
===================================================================================

Warnings:
[1] Covariance matrix calculated using the outer product of gradients (complex-step).
In [77]:
# Forecast future values
forecast_steps = 12  # Adjust the number of steps as needed
forecast = fitted_model.get_forecast(steps=forecast_steps)
forecast_index = pd.date_range(gasprice['Date'].max() + pd.DateOffset(months=1), periods=forecast_steps, freq='M')
forecast_values = forecast.predicted_mean

# Plot the original data and forecasted values
plt.plot(gasprice['Date'], gasprice['Gasoline Price'], label='Historical Data')
plt.plot(forecast_index, forecast_values, label='Forecasted Values', linestyle='dashed')
plt.title('Gasoline Price Forecast')
plt.xlabel('Date')
plt.ylabel('Gasoline Price')
plt.xticks(rotation=90)
plt.legend()
plt.show()
In [69]:
from statsmodels.tsa.arima.model import ARIMA

# Fit ARIMA model
model = ARIMA(gasprice['Gasoline Price'], order=(1, 1, 1))  # Set appropriate values for p, d, and q
fitted_model = model.fit()

# Forecast future values
forecast_steps = 12  # Adjust the number of steps as needed
forecast = fitted_model.get_forecast(steps=forecast_steps)
forecast_index = pd.date_range(gasprice['Date'].max() + pd.DateOffset(months=1), periods=forecast_steps, freq='M')
forecast_values = forecast.predicted_mean
confidence_intervals = forecast.conf_int()  # Get confidence intervals

# Display the forecasted values and confidence intervals
forecast_df = pd.DataFrame({
    'Date': forecast_index,
    'Forecasted Price': forecast_values
})

print(forecast_df)
         Date  Forecasted Price
36 2023-11-30         63.439728
37 2023-12-31         63.217596
38 2024-01-31         63.272487
39 2024-02-29         63.258923
40 2024-03-31         63.262275
41 2024-04-30         63.261446
42 2024-05-31         63.261651
43 2024-06-30         63.261601
44 2024-07-31         63.261613
45 2024-08-31         63.261610
46 2024-09-30         63.261611
47 2024-10-31         63.261611

Gasoline Price (FORECAST in Excel)¶

In [74]:
gasforecast = pd.read_excel('gaspricemod.xlsx')
In [75]:
gasforecast = gasforecast.drop(index=range(0, 36))
gasforecast
Out[75]:
Date Gasoline Price
36 2023-11-01 63.271609
37 2023-12-01 69.526763
38 2024-01-01 69.702851
39 2024-02-01 69.878938
40 2024-03-01 70.043665
41 2024-04-01 70.219752
42 2024-05-01 70.390159
43 2024-06-01 70.566246
44 2024-07-01 70.736654
45 2024-08-01 70.912741
46 2024-09-01 71.088828
47 2024-10-01 71.259235
48 2024-11-01 71.435323
49 2024-12-01 71.605730
50 2025-01-01 71.781817
In [118]:
gasforecasted = pd.read_excel('gaspriceforecasted.xlsx')
gasforecasted
Out[118]:
Date Gasoline Price Forecasted Price
0 2020-11-01 53.6064 NaN
1 2020-12-01 54.1648 NaN
2 2021-01-01 56.9568 NaN
3 2021-02-01 60.3072 NaN
4 2021-03-01 59.1904 NaN
5 2021-04-01 58.6320 NaN
6 2021-05-01 60.8656 NaN
7 2021-06-01 62.5408 NaN
8 2021-07-01 63.6576 NaN
9 2021-08-01 63.0992 NaN
10 2021-09-01 57.5152 NaN
11 2021-10-01 70.3584 NaN
12 2021-11-01 69.8000 NaN
13 2021-12-01 67.5664 NaN
14 2022-01-01 72.5920 NaN
15 2022-02-01 69.8000 NaN
16 2022-03-01 79.8512 NaN
17 2022-04-01 78.7344 NaN
18 2022-05-01 86.5520 NaN
19 2022-06-01 86.5520 NaN
20 2022-07-01 75.3840 NaN
21 2022-08-01 73.1504 NaN
22 2022-09-01 63.0992 NaN
23 2022-10-01 64.7744 NaN
24 2022-11-01 68.1248 NaN
25 2022-12-01 63.0992 NaN
26 2023-01-01 69.8000 NaN
27 2023-02-01 69.2416 NaN
28 2023-03-01 63.0992 NaN
29 2023-04-01 64.7744 NaN
30 2023-05-01 58.6320 NaN
31 2023-06-01 60.3072 NaN
32 2023-07-01 63.6576 NaN
33 2023-08-01 68.1248 NaN
34 2023-09-01 67.5664 NaN
35 2023-10-01 62.5408 NaN
36 2023-11-01 NaN 63.271609
37 2023-12-01 NaN 69.526763
38 2024-01-01 NaN 69.702851
39 2024-02-01 NaN 69.878938
40 2024-03-01 NaN 70.043665
41 2024-04-01 NaN 70.219752
42 2024-05-01 NaN 70.390159
43 2024-06-01 NaN 70.566246
44 2024-07-01 NaN 70.736654
45 2024-08-01 NaN 70.912741
46 2024-09-01 NaN 71.088828
47 2024-10-01 NaN 71.259235
48 2024-11-01 NaN 71.435323
49 2024-12-01 NaN 71.605730
50 2025-01-01 NaN 71.781817
In [117]:
from datetime import datetime

# Convert 'Date' column to datetime format
gasforecasted['Date'] = pd.to_datetime(gasforecasted['Date'], format='%d-%b-%y')

# Plotting
plt.figure(figsize=(10, 6))

# Plot Gasoline Price
plt.plot(gasforecasted['Date'], gasforecasted['Gasoline Price'], color='blue', label='Gasoline Price')

# Plot Forecasted Price
plt.plot(gasforecasted['Date'], gasforecasted['Forecasted Price'], color='orange', linestyle='dashed', label='Forecasted Price')

# Labeling and formatting
plt.title('Gasoline Price and Forecasted Price')
plt.xlabel('Date')
plt.ylabel('Price')
plt.legend()
plt.grid(True)
plt.show()

Traffic¶

In [88]:
traffic
Out[88]:
Year Car PUV UV Taxi Pub Truck Trailer MC Tricycle
0 2021 1399242 73766 25805 130855 24693 84738 18477 1421642 18455
1 2022 1563069 100876 33639 125008 23412 74942 20030 1573729 21050
In [ ]: