Download CV

Vehicle behaviors and City traffic

This project roams around the demographics of cars over different factors.

Dataset:

This dataset was consists of 11 fields and 36 records. Python libraries like Numpy, Pandas, Seaborn, Matplotlib.

Key Visualizations

  • Traffic Pattern Analysis
  • Energy Consumption Trends
  • Impact of Weather Conditions on Vehicles
  • Correlations between different factors
  • Impact of economic conditions on traffic
  • Random event impact assessment
  • Peak hour analysis

Traffic Trend Analysis

1: Average Speed of Vehicles by Day and Hour:

undefined

High Speed Periods:

Friday at 2 PM: This period shows a high average speed, indicated by the lightest color on the chart.

Saturday at 11 AM: Another high-speed period with a light color.

Low Speed Periods:

Wednesday at 10 AM: The lowest speed is observed during this time, as shown by the darkest color.

Sunday at 10 AM: This period also shows a relatively lower speed.

Other Notable Periods:

Monday at 10 AM: Lower speeds are observed, represented by a darker blue color.

Thursday at 4 PM and 6 PM: Moderate speeds are observed during these periods.

Friday at 9 AM and 8 AM: Higher speeds are seen, represented by lighter colors.

Interpretation:

The chart suggests that vehicle speeds vary significantly depending on the day of the week and the hour of the day.

Weekdays generally show varied speeds throughout the day, while weekends (Saturday and Sunday) show periods of both high and low speeds.

Understanding these patterns can be valuable for traffic management and planning, helping to identify peak and off-peak hours for traffic flow optimization.

2: Average vehicle speed over time for each city :

undefinedThe chart illustrates the trends in average vehicle speed throughout the day for New York, Los Angeles, and Chicago. The line chart features three distinct lines representing each city, with shaded areas indicating the confidence intervals of the data.

  • In New York, vehicle speed peaks around 10 AM at approximately 60 mph before steadily declining to its lowest point of around 45 mph at 4 PM, followed by a slight rise towards 6 PM.
  • Los Angeles shows the highest peak speed of about 65 mph at 10 AM, followed by a sharp drop to 40 mph by 2 PM, and then a recovery to 50 mph by 6 PM.
  • Chicago starts at a lower speed of around 45 mph at 8 AM, increases gradually to 50 mph by 10 AM, then steadily drops to 35 mph by 4 PM, and finally rises sharply to 50 mph by 6 PM.

Insights:

The chart reveals common patterns across all three cities, with higher speeds in the morning, a dip in the afternoon, and a partial recovery in the evening. These insights can be valuable for traffic management, public safety, and urban planning, as they highlight peak and off-peak times that require targeted interventions to optimize traffic flow and enhance road safety.

3:Analyze the distribution of vehicle speeds during different weather conditions:

undefinedA box plot have been used to summarize the impact of weather conditions over speed of the vehicle. Each box plot represents the distribution of vehicle speeds for a specific weather condition, with the median, quartiles, and potential outliers clearly depicted.

Under Sunny conditions, vehicle speeds are relatively high, with a median around 55 mph and a range between 50 and 60 mph.

Rainy weather shows a significant reduction in speeds, with a median close to 40 mph and a tighter interquartile range between 35 and 45 mph.

Cloudy conditions exhibit the most variability, with vehicle speeds ranging widely from 30 mph to 65 mph, and a median speed of approximately 50 mph.

Snowy conditions, while exhibiting lower speeds, have a consistent range around the 40 mph mark, with minimal variation.

This visualization highlights how weather conditions influence vehicle speeds, with clear patterns showing that adverse weather (rainy and snowy) leads to reduced speeds, whereas clear weather conditions (sunny and cloudy) allow for higher and more variable speeds.

Insights :

Understanding these patterns is crucial for traffic management and safety planning, as it underscores the need for cautious driving and potential traffic regulations under different weather scenarios.

Correlations between various factors:

undefined

The correlation heatmap visualizes the relationships between three variables: Speed, Hour of Day, and Energy Consumption. The color intensity and the numerical values indicate the strength and direction of the correlations. Speed has a strong negative correlation with Energy Consumption (-0.7) and a moderate negative correlation with Hour of Day (-0.58). Hour of Day shows a moderate positive correlation with Energy Consumption (0.63). The values range from -1 (perfect negative correlation) to 1 (perfect positive correlation), with 0 indicating no correlation. The heatmap effectively highlights these relationships, helping to understand how changes in one variable might affect the others.

Energy Consumption Trends:

undefined

The violin plot displays the distribution of energy consumption for three different vehicle types: Car, Bus, and Truck. Each violin represents the density of the data at different energy consumption values, with the width indicating the frequency of observations. The white dot in each violin represents the median energy consumption, while the thick black bar indicates the interquartile range.

The Car category shows a broader spread of energy consumption values, with a median around 50.

The Bus category has a more concentrated distribution with a median around 60, and the Truck category shows the highest energy consumption values with a median around 65.

This plot effectively illustrates the variation in energy consumption across different vehicle types, highlighting that trucks tend to consume the most energy, followed by buses and then cars.

Impact of Economic conditions on Traffic:

undefined

The box plot illustrates the impact of different economic conditions—Stable, Declining, and Growing—on traffic speed, measured in miles per hour (mph).

The Stable condition shows a relatively wide range of speeds, with the median speed around 52 mph and speeds ranging from approximately 42 to 65 mph.

The Declining condition displays a much narrower range, with a median speed of about 37 mph and speeds tightly clustered between 35 and 40 mph, indicating more consistent but slower traffic.

The Growing condition has a wider distribution than Declining but narrower than Stable, with a median speed around 50 mph and speeds ranging from 35 to 60 mph.

Insights:

This plot highlights that economic conditions influence traffic speeds, with declining economic conditions associated with the slowest and most consistent traffic speeds, while stable conditions result in higher variability in traffic speeds.

Random Event Assessment:

undefined

The box plot titled “Impact of Random Events on Traffic Speed” compares traffic speeds (in mph) during periods when random events did and did not occur. The plot features two box plots: one for when random events did not occur (“False”) and one for when they did (“True”).

For the “False” category, traffic speeds show a wide range with the interquartile range (IQR) stretching from around 40 to 55 mph, a median speed of about 50 mph, and the speeds ranging from approximately 30 to 65 mph.

In contrast, the “True” category, representing periods with random events, shows a narrower IQR from roughly 47 to 51 mph, a median speed just below 50 mph, and overall speeds ranging from around 45 to 52 mph.

Insights:

This suggests that traffic speeds are more consistent and slightly lower when random events occur, whereas there is more variability in speeds when no random events are present.

Peak Hour Analysis:

undefined

This bar chart displays the number of observations recorded during various hours of the day. Each bar represents a specific hour, with the height of the bar indicating the count of observations for that hour. According to the chart, the observations are consistently distributed across five specific time points: 1 PM, 12 PM, 5 PM, 6 PM, and 8 AM, with each hour having exactly 4 observations. The hours that have no observations include 10 AM, 2 PM, 4 PM, and 9 AM, indicating a lack of data collection or events during these times. The uniformity in the number of observations at the recorded hours suggests a specific pattern or scheduled activity occurring at these times, whereas the absence of data in the other hours might indicate non-peak periods or intervals of inactivity.

Here’s the link for the Github Repository of the project :

https://github.com/tayyabads/City-Traffic-and-Vehicle-Behaviors/tree/main