Skip to content

pradip-data/World-Merchandise-Trade

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

50 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŒ Global Merchandise Trade (1947-2023) Analysis using ChatGPT AI, Google BigQuery & Python

๐Ÿ“Œ Project Overview

This project analyzes global merchandise trade trends from 1947 to 2023, with a primary focus on India's trade performance. The dataset is sourced from Google BigQuery and consists of key indicators such as exports, imports, total trade, and trade deficit for different countries. The analysis leverages:

๐Ÿš€ Technologies & Methodologies Used:

โœ… Google BigQuery โ€“ Efficient data extraction & querying ๐Ÿ“Š
โœ… Python โ€“ Data processing, transformation & visualization ๐Ÿ
โœ… ChatGPT AI โ€“ AI-driven insights & trend analysis ๐Ÿค–
โœ… Automated PDF Reports โ€“ Structured storytelling with key findings ๐Ÿ“„


๐ŸŒ Data Source

๐Ÿ“Œ The trade data used in this project is sourced from the World Trade Organization (WTO).
๐Ÿ”— Official WTO Merchandise Trade Statistics: WTO Trade Data


๐Ÿ“Š Key Objectives

๐Ÿ”น Analyze India's exports, imports, total trade, and trade deficit over time.
๐Ÿ”น Compare India's trade performance against global leaders.
๐Ÿ”น Identify key trade trends, challenges, and opportunities for improvement.


๐Ÿ“Š Key Questions Analyzed

1๏ธโƒฃ How has global trade evolved from 1947 to 2023?
2๏ธโƒฃ What is Indiaโ€™s trade performance in exports, imports, and total trade?
3๏ธโƒฃ How has Indiaโ€™s trade deficit changed over time?
4๏ธโƒฃ How does India compare with top exporting and importing nations?
5๏ธโƒฃ What are the key challenges in Indiaโ€™s trade landscape?
6๏ธโƒฃ What strategies can improve Indiaโ€™s trade competitiveness?


๐Ÿ“Š Dataset Overview

๐Ÿ“‚ Dataset Structure

Column Name Description
IndicatorCode Unique code for trade indicators
Indicator Type of trade (Exports/Imports)
ReporterCountry Country reporting the trade
Partner Trade partner country
ProductCode Unique product identifier
Product Name of traded product
Year Trade year
Value_MillionUSD Trade value in million USD

๐Ÿ“ฅ Installation

๐Ÿš€ Clone the Repository

git clone https://github.com/yourusername/Global-Trade-Analysis.git
cd Global-Trade-Analysis

๐Ÿ“ฆ Install Dependencies

pip install pandas matplotlib seaborn fpdf google-cloud-bigquery

๐Ÿ”‘ Set Up Google BigQuery Credentials

1๏ธโƒฃ Create a Google Cloud Project.
2๏ธโƒฃ Enable BigQuery API.
3๏ธโƒฃ Download your service account JSON key and set it as an environment variable:

export GOOGLE_APPLICATION_CREDENTIALS="path/to/your-key.json"

๐Ÿ“œ Analysis & Code Overview

๐Ÿ“Œ Section A : Some BigQuery Code & Console Screenshots

1๏ธโƒฃ Yearly Growth of Trade Value (1948-2023)

WITH YearlyTrade AS (
    SELECT 
        Year, 
        SUM(Value_MillionUSD) AS Trade_Value
    FROM `my-project-1711648161671.World_Trade.Countries_Merchandise_Trade`
    WHERE Product="Total merchandise"
    GROUP BY Year
)
SELECT 
    Year, 
    Trade_Value, 
    LAG(Trade_Value) OVER (ORDER BY Year) AS Prev_Year_Trade_Value,
    ROUND(((Trade_Value - LAG(Trade_Value) OVER (ORDER BY Year)) / LAG(Trade_Value) OVER (ORDER BY Year)) * 100, 2) AS Growth_Percentage
FROM YearlyTrade
ORDER BY Year;

2๏ธโƒฃ India's Total Trade Value (Exports + Imports) (1948-2023)

SELECT 
    Year, 
    SUM(Value_MillionUSD) AS Total_Trade_Value
FROM `my-project-1711648161671.World_Trade.Countries_Merchandise_Trade`
WHERE ReporterCountry = 'India' AND Product ="Total merchandise"
GROUP BY Year
ORDER BY Year;

3๏ธโƒฃ India's Trade Deficit (1948-2023)

WITH IndiaTrade AS (
    SELECT 
        Year,
        SUM(CASE WHEN Indicator = 'exports' THEN Value_MillionUSD ELSE 0 END) AS India_Exports,
        SUM(CASE WHEN Indicator = 'imports' THEN Value_MillionUSD ELSE 0 END) AS India_Imports
    FROM `my-project-1711648161671.World_Trade.Countries_Merchandise_Trade`
    WHERE ReporterCountry = 'India' AND Product ="Total merchandise"
    GROUP BY Year
)
SELECT 
    Year,
    India_Exports,
    India_Imports,
    (India_Imports - India_Exports) AS Trade_Deficit,
    CASE 
        WHEN (India_Imports - India_Exports) > 0 THEN 'Trade Deficit'
        ELSE 'Trade Surplus'
    END AS Trade_Status
FROM IndiaTrade
ORDER BY Year;

๐Ÿ“ธ BigQuery Execution Screenshots

BigQuery Console 1

BigQuery Console 2


๐Ÿ“Œ Section B : Python Code & Visualizations

๐Ÿ“Š Python Code for Data Visualization

import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from reportlab.lib.pagesizes import letter
from reportlab.pdfgen import canvas

# ๐Ÿ“‚ Load dataset
file_path = r"C:\Users\chemi\Downloads\PROJECT -World Merchandise Trade  (Bigquery Project)\BigQuery Output Result\India's Global Trade Case Study (1948-2023).csv"
df = pd.read_csv(file_path)

# ๐Ÿ›  Data Preprocessing
df['Year'] = pd.to_numeric(df['Year'], errors='coerce')
df["Trade Balance"] = df["India_Exports"] - df["India_Imports"]
df["Total Trade"] = df["India_Exports"] + df["India_Imports"]

# ๐Ÿ”ฅ 1. India's Exports & Imports Over Time
plt.figure(figsize=(12, 6))
sns.lineplot(x="Year", y="India_Exports", data=df, label="Exports", marker="o", color="blue")
sns.lineplot(x="Year", y="India_Imports", data=df, label="Imports", marker="s", color="red")
plt.title("India's Exports & Imports (1948-2023)")
plt.xlabel("Year")
plt.ylabel("USD Billion")
plt.legend()
plt.grid(True)
plt.show()

๐Ÿ“ธ Generated Visualizations

1. Export & Import Growth Trend (2013-2023)

Export & Import Growth Trend (2013-2023)

2. India's Imports & Exports Trend (1948-2023)

India's Imports & Exports Trend (1948-2023)

3. India's Trade Breakdown 2023

India's Trade Breakdown 2023

4. India's Share in Global Trade over Time

India's Share in Global Trade over Time

5. Top 10 Countries with Highest Trade Deficit

Top 10 Countries with Highest Trade Deficit

6. India's Position in Trade 2023

India's Position in Trade 2023

7. Trade Deficit Comparison between India and China (2023)

Trade Deficit Comparison between India and China (2023)


๐Ÿ” Section C : AI-Generated Reports

๐Ÿ“„ 1. Detailed Insights, Observations, and Recommendations on India's Trade Performance (2023)

๐Ÿ“Œ Comprehensive analysis covering key insights, trends, and expert recommendations for India's trade performance in 2023.
๐Ÿ“‚ View Report


๐Ÿ“„ 2. India's Product-wise Trade Performance (1948-2023)

๐Ÿ“Œ In-depth report analyzing India's product-wise trade trends from 1948 to 2023, highlighting key patterns and growth opportunities.
๐Ÿ“‚ View Report


๐ŸŒ India's Trade Performance Analysis (2023) ๐Ÿš€

๐Ÿ“Š Insights: India's Trade Performance in 2023

  • Exports: ๐Ÿ’ฐ $431,574 Million USD
  • India's Export Percentage: ๐ŸŒŽ 1.81%
  • Export Rank: ๐Ÿ“ˆ 17
  • Imports: ๐Ÿ’ฐ $672,231 Million USD
  • India's Import Percentage: ๐ŸŒ 2.77%
  • Import Rank: ๐Ÿ“‰ 8
  • Total Trade: ๐Ÿ’ฐ $1,103,805 Million USD
  • India's Total Trade Percentage: ๐ŸŒ 2.3%
  • Trade Rank: ๐Ÿ“Š 14
  • Trade Deficit: โŒ $240,657 Million USD

India remains one of the largest players in global trade. In 2023, India's exports crossed $431,574 million, placing it among the top exporters worldwide. However, its imports outpaced exports, leading to a significant trade deficit. India continues to be a major importer of crude oil, gold, and electronic components, while its key export sectors include pharmaceuticals, IT services, and textiles. The trade balance has been influenced by global economic conditions, currency fluctuations, and demand shifts in international markets.


๐ŸŒŽ Top Exporting Countries & Rankings (2023)

  • 1๏ธโƒฃ China - $3,379,255M
  • 2๏ธโƒฃ United States - $2,020,606M
  • 3๏ธโƒฃ Germany - $1,718,251M
  • 4๏ธโƒฃ Netherlands - $936,392M
  • 5๏ธโƒฃ Japan - $717,261M
  • 6๏ธโƒฃ Italy - $676,993M
  • 7๏ธโƒฃ France - $648,569M
  • 8๏ธโƒฃ South Korea - $632,226M
  • 9๏ธโƒฃ Mexico - $593,005M
  • ๐Ÿ”Ÿ Hong Kong - $573,871M

๐ŸŒ Top Importing Countries & Rankings (2023)

  • 1๏ธโƒฃ United States - $3,172,476M
  • 2๏ธโƒฃ China - $2,556,565M
  • 3๏ธโƒฃ Germany - $1,476,656M
  • 4๏ธโƒฃ Netherlands - $842,331M
  • 5๏ธโƒฃ United Kingdom - $791,523M
  • 6๏ธโƒฃ France - $786,158M
  • 7๏ธโƒฃ Japan - $785,796M
  • 8๏ธโƒฃ India - $672,231M
  • 9๏ธโƒฃ Hong Kong - $653,696M
  • ๐Ÿ”Ÿ South Korea - $642,572M

๐Ÿ’ฐ Countries with the Highest Trade Surpluses (2023)

๐Ÿ”น China - $822,690M ๐Ÿ”น Germany - $241,595M ๐Ÿ”น Russia - $120,925M ๐Ÿ”น Saudi Arabia - $113,078M ๐Ÿ”น Netherlands - $94,061M


๐Ÿ”ด Countries with the Highest Trade Deficits (2023)

โŒ United States - $1,151,870M โŒ United Kingdom - $270,483M โŒ India - $240,657M โŒ France - $137,589M โŒ Tรผrkiye - $106,327M


โš ๏ธ Key Challenges Identified

  • 1๏ธโƒฃ High Import Dependency ๐Ÿญ: India imports more than it exports in key categories like fuels, machinery, and pharmaceuticals, leading to a trade imbalance.
  • 2๏ธโƒฃ Weak Export Competitiveness ๐Ÿ“‰: India's export share (1.81%) is much lower than its economic size, indicating low global competitiveness.
  • 3๏ธโƒฃ Sector-Specific Deficits ๐Ÿฅ: Deficits in pharmaceuticals and food sectors suggest a need for domestic production growth and export incentives.
  • 4๏ธโƒฃ Limited Market Penetration ๐ŸŒŽ: India relies heavily on traditional export markets, limiting its trade reach.

๐ŸŽฏ Strategic Recommendations & Policy Suggestions

A. ๐Ÿš€ Boosting Exports

โœ… Expand High-Value Manufacturing ๐Ÿ”ง

  • Encourage semiconductor, AI, and high-tech industries
  • Invest in automobile and electronics manufacturing โœ… Strengthen Trade Agreements ๐Ÿค
  • Negotiate preferential trade deals with Africa, Latin America, and Southeast Asia โœ… Enhance Export Incentives ๐Ÿ“ˆ
  • Introduce tax benefits for export-driven industries

B. ๐Ÿ“‰ Reducing Import Dependence

โœ… Increase Domestic Production in Deficit Sectors ๐Ÿญ

  • Expand pharmaceutical manufacturing to reduce $17.9B deficit
  • Boost agriculture and textile production to cut food & clothing imports โœ… Invest in Renewable Energy โ˜€๏ธ
  • Reduce oil import dependency ($220.6B) by investing in solar, wind, and green hydrogen

C. ๐Ÿšข Strengthening Trade Infrastructure

โœ… Improve Logistics & Ports โš“

  • Reduce trade costs and shipment delays to make exports more competitive โœ… Ease Business Regulations ๐Ÿ“œ
  • Simplify tax laws and streamline customs processes for exporters

D. ๐ŸŒ Diversifying Export Markets

โœ… Expand Beyond Traditional Markets ๐ŸŒ

  • Strengthen trade with Africa, Middle East, and Latin America
  • Reduce over-reliance on US and European markets

๐Ÿ”ฎ Final Outlook

India has the potential to become a major global trade powerhouse but must address its trade deficit, boost exports, and reduce import dependence. By implementing strategic manufacturing policies, improving infrastructure, and diversifying export markets, India can move up in global trade rankings and achieve a more balanced trade profile in the coming years.

๐ŸŽฏ Key Focus Areas for 2024 & Beyond

  • โœ… Strengthen high-value manufacturing exports
  • โœ… Reduce fuel & machinery import dependency
  • โœ… Improve trade policies and agreements
  • โœ… Expand global market reach beyond traditional partners
  • โœ… Invest in logistics and supply chain efficiency ๐Ÿšข

๐Ÿ“Š BigQuery Analysis & Python Visualizations

๐Ÿ“Œ BigQuery SQL Code & Execution Screenshots ๐Ÿ“Œ Python Code for Trade Analysis & Data Visualization ๐Ÿ“Œ ChatGPT AI Report Generation & Insights

๐Ÿ† Final Thoughts

India has the potential to become a major global trade powerhouse but must address:

๐Ÿ“‰ Trade Deficit Challenges โ€“ Reduce reliance on imports.
๐Ÿš€ Boost Export Competitiveness โ€“ Focus on high-value industries.
๐ŸŒŽ Expand Market Reach โ€“ Diversify beyond traditional partners.

By implementing strategic policies, investing in infrastructure, and expanding global trade agreements, India can significantly improve its trade rankings and achieve a balanced trade profile in the coming years.


๐Ÿ”— Author & Contributions ๐Ÿ‘ค Your Name - Mangroliya Pradip ๐Ÿ“ฉ For inquiries, reach out at: pradipias2023@gmail.com

About

This project analyzes global merchandise trade trends from 1948 to 2023 using Google BigQuery and Python. It includes country-wise and product-wise trade performance, covering exports, imports, total trade, and trade deficit. The analysis features SQL queries for BigQuery, data visualizations, and detailed reports to uncover long-term trade pattern

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors