Finding Heavy Traffic Indicators on I-94

We want to determine a few indicators of heavy traffic on I-94. These indicators can be weather type, time of the day, time of the week, etc.

Some barplots may take time to load!

In [2]:
# importing and examining the data
import pandas as pd
Metro_traffic_vol = pd.read_csv('Metro_Interstate_Traffic_Volume.csv')
Metro_traffic_vol.head()
Metro_traffic_vol.tail()
Metro_traffic_vol.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 48204 entries, 0 to 48203
Data columns (total 9 columns):
 #   Column               Non-Null Count  Dtype  
---  ------               --------------  -----  
 0   holiday              48204 non-null  object 
 1   temp                 48204 non-null  float64
 2   rain_1h              48204 non-null  float64
 3   snow_1h              48204 non-null  float64
 4   clouds_all           48204 non-null  int64  
 5   weather_main         48204 non-null  object 
 6   weather_description  48204 non-null  object 
 7   date_time            48204 non-null  object 
 8   traffic_volume       48204 non-null  int64  
dtypes: float64(3), int64(2), object(4)
memory usage: 3.3+ MB

Analyzing the traffic volume

In [3]:
Metro_traffic_vol['traffic_volume'].describe()
Out[3]:
count    48204.000000
mean      3259.818355
std       1986.860670
min          0.000000
25%       1193.000000
50%       3380.000000
75%       4933.000000
max       7280.000000
Name: traffic_volume, dtype: float64
In [4]:
%matplotlib inline
from matplotlib import pyplot as plt
In [5]:
Metro_traffic_vol.hist('traffic_volume')
plt.show()

Daytime and nighttime influence the traffic volume

In [6]:
# We will use barplot to observe traffic volume vs time of the day
# converting date_time to datetime format
Metro_traffic_vol['date_time'] = pd.to_datetime(Metro_traffic_vol['date_time'], format='%Y-%m-%d %H:%M:%S')

# conversion to string
Metro_traffic_vol['date_time_s'] = Metro_traffic_vol['date_time'].dt.strftime("%Y-%m-%d %H:%M:%S")

# Separating date_time to date and time
Metro_traffic_vol[['date','time']] = Metro_traffic_vol['date_time_s'].str.split(' ', expand=True )

Metro_traffic_vol.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 48204 entries, 0 to 48203
Data columns (total 12 columns):
 #   Column               Non-Null Count  Dtype         
---  ------               --------------  -----         
 0   holiday              48204 non-null  object        
 1   temp                 48204 non-null  float64       
 2   rain_1h              48204 non-null  float64       
 3   snow_1h              48204 non-null  float64       
 4   clouds_all           48204 non-null  int64         
 5   weather_main         48204 non-null  object        
 6   weather_description  48204 non-null  object        
 7   date_time            48204 non-null  datetime64[ns]
 8   traffic_volume       48204 non-null  int64         
 9   date_time_s          48204 non-null  object        
 10  date                 48204 non-null  object        
 11  time                 48204 non-null  object        
dtypes: datetime64[ns](1), float64(3), int64(2), object(6)
memory usage: 4.4+ MB
In [7]:
# barplot of traffic volume vs time of the day
plt.bar(Metro_traffic_vol['time'],Metro_traffic_vol['traffic_volume'])
plt.xlabel('time of the day')
plt.ylabel('traffic volume')
plt.xticks(rotation=45)
plt.show()

This figure shows that the traffic volume is highest from 5 a.m. to 5 p.m.

In [8]:
# extracting the hour column from date_time
Metro_traffic_vol['hour'] = Metro_traffic_vol['date_time'].dt.hour
Metro_traffic_vol.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 48204 entries, 0 to 48203
Data columns (total 13 columns):
 #   Column               Non-Null Count  Dtype         
---  ------               --------------  -----         
 0   holiday              48204 non-null  object        
 1   temp                 48204 non-null  float64       
 2   rain_1h              48204 non-null  float64       
 3   snow_1h              48204 non-null  float64       
 4   clouds_all           48204 non-null  int64         
 5   weather_main         48204 non-null  object        
 6   weather_description  48204 non-null  object        
 7   date_time            48204 non-null  datetime64[ns]
 8   traffic_volume       48204 non-null  int64         
 9   date_time_s          48204 non-null  object        
 10  date                 48204 non-null  object        
 11  time                 48204 non-null  object        
 12  hour                 48204 non-null  int64         
dtypes: datetime64[ns](1), float64(3), int64(3), object(6)
memory usage: 4.8+ MB

Comparing day and night time traffic

In [9]:
# Dividing traffic into day and night time
Daytime_traffic = Metro_traffic_vol[(Metro_traffic_vol['hour']>=7) & (Metro_traffic_vol['hour']<=19)]
Nignttime_traffic = Metro_traffic_vol[(Metro_traffic_vol['hour']>19) | (Metro_traffic_vol['hour']<7)]
In [10]:
# We are plotting day time and night time traffic against hours of the day
plt.subplot(1,2,1)
plt.bar(Daytime_traffic['hour'],Daytime_traffic['traffic_volume'],label='Day time')
plt.xticks(rotation = 30)
plt.ylim([0,8500])
plt.subplot(1,2,1)
plt.bar(Nignttime_traffic['hour'],Nignttime_traffic['traffic_volume'],label='Night time')
plt.xticks(rotation = 30)
plt.title('Night vs Day traffic')
plt.ylabel('Traffic')
plt.xlabel('Hour')
plt.ylim([0,8500])
plt.legend()
plt.show()
<ipython-input-10-427431e78c11>:6: MatplotlibDeprecationWarning: Adding an axes using the same arguments as a previous axes currently reuses the earlier instance.  In a future version, a new instance will always be created and returned.  Meanwhile, this warning can be suppressed, and the future behavior ensured, by passing a unique label to each axes instance.
  plt.subplot(1,2,1)
/dataquest/system/env/python3/lib/python3.8/site-packages/IPython/core/pylabtools.py:132: UserWarning: Creating legend with loc="best" can be slow with large amounts of data.
  fig.canvas.print_figure(bytes_io, **kw)
In [11]:
# Histograms of Traffic volume for day and night times
plt.subplot(1,2,1)
plt.hist(Daytime_traffic['traffic_volume'])
plt.title('Day time traffic volume')
plt.ylabel('traffic')
plt.xlabel('occurrence')
plt.subplot(1,2,2)
plt.hist(Nignttime_traffic['traffic_volume'])        
plt.title('Night time traffic volume')
plt.xlabel('occurrence')
plt.ylim([0,8000])
plt.show()
In [12]:
Daytime_traffic.describe()
Out[12]:
temp rain_1h snow_1h clouds_all traffic_volume hour
count 25838.000000 25838.000000 25838.000000 25838.000000 25838.000000 25838.000000
mean 282.347796 0.502320 0.000234 53.040135 4649.292360 12.929948
std 13.302562 61.167614 0.008511 37.590946 1202.321987 3.764979
min 0.000000 0.000000 0.000000 0.000000 0.000000 7.000000
25% 272.720000 0.000000 0.000000 5.000000 4021.000000 10.000000
50% 283.867000 0.000000 0.000000 75.000000 4736.000000 13.000000
75% 293.610000 0.000000 0.000000 90.000000 5458.000000 16.000000
max 310.070000 9831.300000 0.510000 100.000000 7280.000000 19.000000
In [13]:
Nignttime_traffic.describe()
Out[13]:
temp rain_1h snow_1h clouds_all traffic_volume hour
count 22366.000000 22366.000000 22366.000000 22366.000000 22366.000000 22366.000000
mean 279.886677 0.140120 0.000209 45.113386 1654.648484 9.628588
std 13.257728 1.125004 0.007752 40.183455 1425.175292 9.033028
min 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
25% 271.580000 0.000000 0.000000 1.000000 486.000000 2.000000
50% 281.150000 0.000000 0.000000 40.000000 1056.500000 5.000000
75% 290.400000 0.000000 0.000000 90.000000 2630.750000 21.000000
max 306.290000 55.630000 0.510000 100.000000 6386.000000 23.000000

These data shows a higher traffic volume during daytime

traffic volume change with month and day of the week

In [14]:
#Daytime traffic volume by month 
Daytime_traffic['month'] = Daytime_traffic['date_time'].dt.month
by_month_d = Daytime_traffic.groupby('month').mean()
by_month_d['traffic_volume']
<ipython-input-14-a0452451b2db>:2: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  Daytime_traffic['month'] = Daytime_traffic['date_time'].dt.month
Out[14]:
month
1     4385.217310
2     4593.187798
3     4761.529676
4     4771.232816
5     4788.966639
6     4791.087488
7     4502.628360
8     4818.434690
9     4755.709916
10    4809.481678
11    4588.910486
12    4276.567081
Name: traffic_volume, dtype: float64
In [15]:
#Nighttime traffic volume by month 
Nignttime_traffic['month'] = Nignttime_traffic['date_time'].dt.month
by_month_n = Nignttime_traffic.groupby('month').mean()
by_month_n['traffic_volume']
<ipython-input-15-bc33c8392910>:2: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  Nignttime_traffic['month'] = Nignttime_traffic['date_time'].dt.month
Out[15]:
month
1     1507.162089
2     1595.244973
3     1678.887584
4     1653.788423
5     1692.370461
6     1792.696987
7     1710.968582
8     1766.493392
9     1670.819290
10    1710.422642
11    1562.349509
12    1499.395094
Name: traffic_volume, dtype: float64
In [16]:
#Showing day and night traffic volume per month 
plt.plot(by_month_d['traffic_volume'],label='Day')
plt.plot(by_month_n['traffic_volume'],label='Night')
plt.xlabel('Month')
plt.ylabel('Traffic volume')
plt.legend()
plt.show()
In [17]:
#Showing daytime traffic volume per month 
plt.plot(by_month_d['traffic_volume'])
plt.title('Daytime traffic volume per month')
plt.xlabel('Month')
plt.ylabel('Traffic volume')
plt.show()

We can notice a decrease in traffic volume in july

In [18]:
#Daytime traffic volume by day of the week 
Daytime_traffic['dayofweek'] = Daytime_traffic['date_time'].dt.dayofweek
by_dayofweek_d = Daytime_traffic.groupby('dayofweek').mean()
by_dayofweek_d['traffic_volume']
<ipython-input-18-51d74c946301>:2: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  Daytime_traffic['dayofweek'] = Daytime_traffic['date_time'].dt.dayofweek
Out[18]:
dayofweek
0    4746.208029
1    5036.062431
2    5141.231163
3    5163.688063
4    5161.533588
5    3884.065668
6    3410.368091
Name: traffic_volume, dtype: float64
In [19]:
#Showing daytime traffic volume per month 
plt.plot(by_dayofweek_d['traffic_volume'])
plt.title('Daytime traffic volume per day of the week')
plt.xlabel('Day of the week')
plt.ylabel('Traffic volume')
plt.show()

The data shows clearly that the traffic volume decreases in the weekend

In [20]:
#Nighttime traffic volume by day of the week 
Nignttime_traffic['dayofweek'] = Nignttime_traffic['date_time'].dt.dayofweek
by_dayofweek_n = Nignttime_traffic.groupby('dayofweek').mean()
by_dayofweek_n['traffic_volume']
<ipython-input-20-6d1561ac97b6>:2: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  Nignttime_traffic['dayofweek'] = Nignttime_traffic['date_time'].dt.dayofweek
Out[20]:
dayofweek
0    1606.159456
1    1752.048047
2    1781.810205
3    1867.965779
4    1919.764650
5    1484.403986
6    1172.446702
Name: traffic_volume, dtype: float64
In [21]:
#Showing nighttime traffic volume per month 
plt.plot(by_dayofweek_n['traffic_volume'])
plt.title('Nighttime traffic volume per day of the week')
plt.xlabel('Day of the week')
plt.ylabel('Traffic volume')
plt.show()

The same tendancy is confirmed for nighttime traffic

In [22]:
# grouping traffic volume by business days and weekend 
Daytime_traffic['hour'] = Daytime_traffic['date_time'].dt.hour
bussiness_days = Daytime_traffic.copy()[Daytime_traffic['dayofweek'] <= 4] # 4 == Friday
weekend = Daytime_traffic.copy()[Daytime_traffic['dayofweek'] >= 5] # 5 == Saturday
by_hour_business = bussiness_days.groupby('hour').mean()
by_hour_weekend = weekend.groupby('hour').mean()

print(by_hour_business['traffic_volume'])
print(by_hour_weekend['traffic_volume'])
hour
7     6030.413559
8     5503.497970
9     4895.269257
10    4378.419118
11    4633.419470
12    4855.382143
13    4859.180473
14    5152.995778
15    5592.897768
16    6189.473647
17    5784.827133
18    4434.209431
19    3298.340426
Name: traffic_volume, dtype: float64
hour
7     1589.365894
8     2338.578073
9     3111.623917
10    3686.632302
11    4044.154955
12    4372.482883
13    4362.296564
14    4358.543796
15    4342.456881
16    4339.693805
17    4151.919929
18    3811.792279
19    3220.234120
Name: traffic_volume, dtype: float64
<ipython-input-22-2b4d0e3f6674>:2: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  Daytime_traffic['hour'] = Daytime_traffic['date_time'].dt.hour
In [23]:
#plotting the traffic volume changes by time of the day for business days and the weekend.

plt.subplot(1,2,1)
plt.plot(by_hour_business['traffic_volume'])
plt.title('business days')
plt.xlim([6,20])
plt.ylim([1500,6500])
plt.xlabel('hour of the day')
plt.ylabel('traffic volume')
plt.subplot(1,2,2)
plt.plot(by_hour_weekend['traffic_volume'])
plt.title('weekend')
plt.xlim([6,20])
plt.ylim([1500,6500])
plt.xlabel('hour of the day')
plt.show()

The rush hours of the business days are different than the ones in the weekends.

Looking at the effect weather on traffic volume

In [24]:
# We will check the effect of rain, snow, temperature and cloudy weather on traffic
# Calculating Daytime traffic correlations
print("traffic vs rain correlation : ",Daytime_traffic['traffic_volume'].corr(Daytime_traffic['rain_1h']))
print("traffic vs snow correlation : ", Daytime_traffic['traffic_volume'].corr(Daytime_traffic['snow_1h']))
print("traffic vs temperature correlation : ", Daytime_traffic['traffic_volume'].corr(Daytime_traffic['temp']))
print("traffic vs clouds correlation : ", Daytime_traffic['traffic_volume'].corr(Daytime_traffic['clouds_all']))
traffic vs rain correlation :  0.004020328553256915
traffic vs snow correlation :  0.003768465652292508
traffic vs temperature correlation :  0.11808381454022034
traffic vs clouds correlation :  -0.033409503731993966

Daytime traffic is positively (slightly) correlated with the temperature which is negligible

In [25]:
# Calculating nighttime traffic correlations
print("traffic vs rain correlation : ", Nignttime_traffic['traffic_volume'].corr(Nignttime_traffic['rain_1h']))
print("traffic vs snow correlation : ", Nignttime_traffic['traffic_volume'].corr(Nignttime_traffic['snow_1h']))
print("traffic vs temperature correlation : ", Nignttime_traffic['traffic_volume'].corr(Nignttime_traffic['temp']))
print("traffic vs clouds correlation : ", Nignttime_traffic['traffic_volume'].corr(Nignttime_traffic['clouds_all']))
traffic vs rain correlation :  -0.011791320379425676
traffic vs snow correlation :  -0.005393682801516176
traffic vs temperature correlation :  0.06932435026636616
traffic vs clouds correlation :  0.0038956123751536426

Nighttime traffic is very slightly correlated with the temperature which is negligible.
Conclusion: We cannot yet demonstrate the effect of the weather on traffic volume and we need further precision.

In [26]:
# We need to check the effect of weather type on traffic volume
# grouping the data based on weather type and description
by_weather_main = Daytime_traffic.groupby('weather_main').mean()
by_weather_description = Daytime_traffic.groupby('weather_description').mean()
In [27]:
print(by_weather_main)
                    temp   rain_1h   snow_1h  clouds_all  traffic_volume  \
weather_main                                                               
Clear         283.884100  0.000000  0.000000    1.676447     4661.666879   
Clouds        282.971967  0.000000  0.000000   62.700890     4746.375927   
Drizzle       284.432372  0.168234  0.000000   84.781609     4712.699060   
Fog           277.378271  0.157739  0.001356   66.281915     4298.933511   
Haze          275.726381  0.060947  0.000000   63.916667     4545.434932   
Mist          279.342164  0.249371  0.000778   75.518370     4530.901782   
Rain          287.172515  3.690371  0.000268   75.771069     4686.953503   
Smoke         292.530000  0.810769  0.000000   49.307692     4447.307692   
Snow          268.052688  0.013233  0.001648   80.945478     4295.594612   
Squall        296.730000  1.020000  0.000000   75.000000     4211.000000   
Thunderstorm  293.542455  1.114671  0.000000   73.742515     4512.479042   

                   hour     month  dayofweek  
weather_main                                  
Clear         12.958539  6.492107   3.143518  
Clouds        13.386734  6.391820   2.999894  
Drizzle       12.825496  7.074190   2.921630  
Fog           10.648936  6.625000   2.827128  
Haze          12.780822  5.873288   2.748858  
Mist          11.527828  6.731175   2.903601  
Rain          13.167904  6.755247   2.905392  
Smoke         13.615385  6.846154   2.230769  
Snow          12.614496  6.375241   2.756895  
Squall        14.000000  7.000000   2.000000  
Thunderstorm  13.323353  7.063872   2.932136  
In [29]:
print(by_weather_description)
                                           temp      rain_1h   snow_1h  \
weather_description                                                      
SQUALLS                              296.730000     1.020000  0.000000   
Sky is Clear                         293.352292     0.000000  0.000000   
broken clouds                        282.400504     0.000000  0.000000   
drizzle                              283.627331     0.143633  0.000000   
few clouds                           284.589033     0.000000  0.000000   
fog                                  277.378271     0.157739  0.001356   
freezing rain                        272.860000     0.000000  0.000000   
haze                                 275.726381     0.060947  0.000000   
heavy intensity drizzle              285.722000     0.267000  0.000000   
heavy intensity rain                 290.292939     2.647347  0.000000   
heavy snow                           269.306841     0.002203  0.000000   
light intensity drizzle              284.841811     0.176705  0.000000   
light intensity shower rain          291.018182     0.393636  0.000000   
light rain                           286.437055     0.134951  0.000000   
light rain and snow                  275.607500     0.317500  0.000000   
light shower snow                    268.213636     0.000000  0.000000   
light snow                           267.159827     0.014611  0.001979   
mist                                 279.342164     0.249371  0.000778   
moderate rain                        287.176745     0.574580  0.000967   
overcast clouds                      278.750160     0.000000  0.000000   
proximity shower rain                291.536423     0.252033  0.000000   
proximity thunderstorm               293.759233     0.938791  0.000000   
proximity thunderstorm with drizzle  287.913333     0.260000  0.000000   
proximity thunderstorm with rain     291.429524     0.831905  0.000000   
scattered clouds                     287.911804     0.000000  0.000000   
shower drizzle                       271.330000     0.000000  0.000000   
shower snow                          268.680000     0.000000  0.000000   
sky is clear                         282.243774     0.000000  0.000000   
sleet                                275.746667     0.000000  0.000000   
smoke                                292.530000     0.810769  0.000000   
snow                                 270.916883     0.022013  0.003312   
thunderstorm                         295.043333     0.829630  0.000000   
thunderstorm with drizzle            287.880000     5.345000  0.000000   
thunderstorm with heavy rain         293.127241     3.163448  0.000000   
thunderstorm with light drizzle      290.885000     2.635000  0.000000   
thunderstorm with light rain         292.243478     1.190000  0.000000   
thunderstorm with rain               293.199524     1.464762  0.000000   
very heavy rain                      292.426250  1250.312500  0.000000   

                                     clouds_all  traffic_volume       hour  \
weather_description                                                          
SQUALLS                               75.000000     4211.000000  14.000000   
Sky is Clear                           0.000000     4802.848812  12.976242   
broken clouds                         72.613417     4715.715045  13.259382   
drizzle                               88.578778     4572.176849  12.472669   
few clouds                            19.396787     4720.890763  13.155020   
fog                                   66.281915     4298.933511  10.648936   
freezing rain                         90.000000     4314.000000  13.500000   
haze                                  63.916667     4545.434932  12.780822   
heavy intensity drizzle               87.533333     4696.533333  12.500000   
heavy intensity rain                  82.195918     4465.771429  13.138776   
heavy snow                            85.327536     4300.826087  12.788406   
light intensity drizzle               82.694943     4783.706362  13.029364   
light intensity shower rain           88.636364     4437.454545  12.545455   
light rain                            72.575135     4735.882162  13.260541   
light rain and snow                   83.500000     5579.750000  15.000000   
light shower snow                     81.909091     4618.636364  13.272727   
light snow                            78.290106     4347.850144  12.403458   
mist                                  75.518370     4530.901782  11.527828   
moderate rain                         80.639860     4639.564103  12.871795   
overcast clouds                       90.119250     4726.877212  13.297594   
proximity shower rain                 77.154472     4760.926829  13.983740   
proximity thunderstorm                72.058997     4538.374631  13.483776   
proximity thunderstorm with drizzle   87.833333     5121.833333  12.166667   
proximity thunderstorm with rain      76.380952     4325.714286  12.428571   
scattered clouds                      40.028014     4822.416808  13.778862   
shower drizzle                        90.000000     4932.666667  11.000000   
shower snow                           90.000000     5664.000000   7.000000   
sky is clear                           1.966885     4637.207671  12.955472   
sleet                                 90.000000     4312.666667  14.000000   
smoke                                 49.307692     4447.307692  13.615385   
snow                                  88.707792     3864.993506  13.551948   
thunderstorm                          70.574074     4568.407407  13.888889   
thunderstorm with drizzle             90.000000     2297.000000  12.500000   
thunderstorm with heavy rain          81.275862     4358.620690  12.896552   
thunderstorm with light drizzle       90.000000     4960.000000  12.833333   
thunderstorm with light rain          76.565217     4336.130435  11.869565   
thunderstorm with rain                82.714286     4452.047619  12.904762   
very heavy rain                       53.375000     4527.375000  12.625000   

                                        month  dayofweek  
weather_description                                       
SQUALLS                              7.000000   2.000000  
Sky is Clear                         7.557235   2.896328  
broken clouds                        6.672202   2.978080  
drizzle                              7.167203   2.977492  
few clouds                           6.183936   2.975904  
fog                                  6.625000   2.827128  
freezing rain                        6.500000   0.500000  
haze                                 5.873288   2.748858  
heavy intensity drizzle              7.600000   2.966667  
heavy intensity rain                 7.122449   2.844898  
heavy snow                           5.107246   2.962319  
light intensity drizzle              7.006525   2.897227  
light intensity shower rain          5.909091   2.909091  
light rain                           6.607568   2.916757  
light rain and snow                  7.500000   1.250000  
light shower snow                    9.545455   1.181818  
light snow                           6.762728   2.733910  
mist                                 6.731175   2.903601  
moderate rain                        6.952214   2.912587  
overcast clouds                      6.081741   3.047771  
proximity shower rain                6.894309   2.943089  
proximity thunderstorm               7.061947   2.870206  
proximity thunderstorm with drizzle  8.500000   2.500000  
proximity thunderstorm with rain     7.000000   3.047619  
scattered clouds                     6.515280   2.983022  
shower drizzle                       6.000000   1.666667  
shower snow                          3.000000   4.000000  
sky is clear                         6.307577   3.186342  
sleet                                7.000000   3.333333  
smoke                                6.846154   2.230769  
snow                                 6.350649   2.584416  
thunderstorm                         7.129630   3.074074  
thunderstorm with drizzle            9.000000   5.000000  
thunderstorm with heavy rain         6.551724   2.862069  
thunderstorm with light drizzle      8.000000   3.333333  
thunderstorm with light rain         6.826087   3.173913  
thunderstorm with rain               7.095238   3.095238  
very heavy rain                      7.625000   1.375000  
In [36]:
#barplotting daytime traffic volume versus weather_main 
Daytime_traffic.groupby('weather_main').traffic_volume.mean().plot.barh()
plt.xlim([0,5000])
plt.xlabel('Traffic volume')
plt.title('Daytime traffic volume versus weather type')
Out[36]:
Text(0.5, 1.0, 'Daytime traffic volume versus weather type')

Based on this plot drizzle and rain cause high traffic but there isn't a significative difference.

In [50]:
# barplotting daytime traffic volume versus weather_description 
Daytime_traffic.groupby('weather_description').traffic_volume.mean().plot.barh()
plt.xlabel('Traffic volume')
plt.title('Daytime traffic volume versus weather description')
plt.figure(figsize=(300,1200))
Out[50]:
<Figure size 30000x120000 with 0 Axes>
<Figure size 30000x120000 with 0 Axes>

Based on this plot shower snow, light rain and snow, proximity thunderstorm with drizzle and thunderstorm with light drizzle cause highest traffics and show the significant effect of weather type on the traffic volume.