Skip to content

About

a data analysis and forecasting project focused on identifying trends, top-performing brands, and year-over-year patterns in synthetic car sales data

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

15 Commits

Folders and files

Repository files navigation

Car Sales Trend Analysis & Forecasting

Analyze and visualize trends in a large synthetic car sales dataset. This project provides a modular framework for data analysis, insight extraction, and visualization, enabling you to explore car sales patterns, compare brands, and predict future sales.

Visualization

Global Top Brand

Bar chart showing which brand was the top seller in the most countries for each year.

Sales Comparison

Bar chart comparing sales of selected brands across years in chosen countries.

Top Selling Brand

Line plot showing the top-selling brand in a specific country over time.

Heatmap of Top Brands

Heatmap visualizing the top brand for each country and year.

Future Sales Prediction

Bar chart showing historical sales and predicted sales for a brand/country/year using linear regression.

Features

  • Data Preparation: Standardizes and aggregates raw sales data for analysis
  • Insight Extraction: Find top brands by country/year, global leaders, and sales totals
  • Visualization: Generate heatmaps, bar charts, line plots, and prediction plots
  • Sales Prediction: Predict future sales for a brand in a country using linear regression
  • Customizable: Easily change countries, brands, and years for your analysis

Project Structure

.
├── dataset.py               # Script to download the dataset from KaggleHub
├── dataset/                 # Folder for all CSV files
├── data_utils.py            # Data loading, cleaning functions, standardizing columns, aggregating sales
├── insights.py              # Functions to extract insights
├── plotting.py              # All plotting functions
├── main.py                  # Main script       
├── output/                  # Folder for all generated plots

Setup

1. Clone the Repository

git clone https://github.com/karmaniket/CarSalesForecast.git
cd CarSalesForecast

2. Install Requirements

pip install pandas matplotlib seaborn kagglehub scikit-learn

3. Download the Dataset

python dataset.py

This will download the dataset from KaggleHub and print the file path. Then the CSV file should be manualy placed in the dataset/ folder.

How to Use

1. Configure Your Analysis

Open main.py and edit the parameters at the top to select the country, brand, and years you want to analyze:

COUNTRY = "USA"
BRAND = "Toyota"
COMPARISON_COUNTRIES = ['USA']
COMPARISON_BRANDS = ['Toyota', 'Volkswagen', 'Ford', 'Chrysler', 'Lexus', 'Chevrolet']
COMPARISON_YEARS = [2020, 2021, 2022, 2023, 2024]
PREDICT_YEAR = 2025
TOTAL_SALES_YEAR = 2024

2. Select Insights/Plots to Run

In main.py, comment or uncomment the function calls to run only the analyses or plots you need. Each block is independent and can be enabled/disabled as needed.

3. Run the Main Script

python main.py

This will generate the selected plots (saved in output/) and print insights to the console.

Example Analyses

  • Compare sales for selected countries, brands, and years
  • Show total sales for a specific brand/country/year
  • Visualize the global top brand by number of countries each year
  • Heatmap of top brands by country and year
  • Trend of top-selling brands in a specific country
  • Predict future sales for a brand in a country for a specific year (using linear regression)

Customization

  • To analyze different countries, brands, or years, change the lists in main.py
  • To generate different plots, comment or uncomment the relevant function calls in main.py
  • All plots will be saved in the output/ directory for easy access

Note

Code is modular; data loading, insights, and plotting are separated for clarity and maintainability.
Dataset is synthetic and intended for demonstration and educational purposes.

Source and Attribution

Synthetic Car Sales Dataset over Million records dataset from Kaggle.

About

a data analysis and forecasting project focused on identifying trends, top-performing brands, and year-over-year patterns in synthetic car sales data

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages