An exploratory data analysis pipeline designed to examine traffic patterns, temporal trends, and weather impacts using the Metro Interstate Traffic Volume dataset.
This script processes historical traffic data to uncover insights regarding when and why congestion occurs. It performs data cleaning, datetime transformations, segregations (daytime vs. nighttime, business days vs. weekends), and visualizes the relationships between traffic volume, temporal cycles, and weather conditions.
Ensure you have Python installed along with the required data science and visualization libraries:
pip install pandas matplotlib
The script expects the dataset file to be located in the exact same directory as the script:
Filename: Metro_Interstate_Traffic_Volume.csv
Navigate to the directory containing the script and dataset, then run: python basics.py
- Dataset inspection: outputs the first and last five rows, alongside structural metadata via
info(). - Traffic volume distribution: generates an overall histogram displaying the general distribution of traffic volumes.
- Daytime vs. Nighttime comparison: splits data into daytime (7:00 AM – 7:00 PM) and nighttime (7:00 PM – 7:00 AM) blocks, showing side-by-side comparative histograms and statistical summaries.
- Temporal trends: monthly average traffic volume trends, day-of-the-week trends
(0=Monday, 6=Sunday), hourly traffic breakdowns contrasting business days against weekends. - Weather impact & correlations: computes correlation matrices between numerical weather metrics and traffic volume, scatter plots mapping traffic volume against temperature and horizontal bar charts displaying average traffic volume grouped by main weather types and detailed weather descriptions.