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.
- 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
.
├── 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 plotsgit clone https://github.com/karmaniket/CarSalesForecast.git
cd CarSalesForecastpip install pandas matplotlib seaborn kagglehub scikit-learnpython dataset.pyThis will download the dataset from KaggleHub and print the file path. Then the CSV file should be manualy placed in the dataset/ folder.
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 = 2024In 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.
python main.pyThis will generate the selected plots (saved in output/) and print insights to the console.
- 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)
- 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.
Synthetic Car Sales Dataset over Million records dataset from Kaggle.




