Introduction
In South Korea's semiconductor industry, the massive bonuses paid to chip workers have become a major economic concern. These bonuses, which can reach hundreds of thousands of dollars, are now being monitored by the central bank as a potential inflation risk. This tutorial will teach you how to analyze wage data and bonus trends using Python and basic data analysis techniques. You'll learn to work with real-world salary data, calculate bonus impacts, and visualize wage trends to understand economic patterns.
Prerequisites
To follow this tutorial, you'll need:
- A computer with internet access
- Python installed (preferably Python 3.7 or higher)
- Basic understanding of Python programming concepts
- Knowledge of fundamental statistics and data analysis
Step-by-Step Instructions
Step 1: Set Up Your Python Environment
First, we need to install the necessary Python libraries for data analysis. Open your terminal or command prompt and run:
pip install pandas numpy matplotlib seaborn
This installs essential libraries for data manipulation, numerical calculations, and visualization. We'll use pandas for handling data, numpy for mathematical operations, and matplotlib/seaborn for creating charts.
Step 2: Create a Sample Dataset
Let's create a simple dataset representing chip worker bonuses and wages. This simulates the real-world scenario from South Korea:
import pandas as pd
import numpy as np
# Create sample data for chip workers
np.random.seed(42)
data = {
'worker_id': range(1, 101),
'base_salary': np.random.normal(50000, 10000, 100), # Base salary between $40,000-$60,000
'bonus_percentage': np.random.uniform(0.1, 0.5, 100), # Bonuses between 10%-50%
'company': np.random.choice(['Samsung', 'SK Hynix', 'LG', 'TSMC'], 100),
'year': np.random.choice([2022, 2023, 2024], 100)
}
# Create DataFrame
df = pd.DataFrame(data)
# Calculate actual bonus amount
df['bonus_amount'] = df['base_salary'] * df['bonus_percentage']
df.head()
This code creates a dataset of 100 chip workers with realistic salary ranges and bonus percentages. The random seed ensures consistent results for demonstration purposes.
Step 3: Calculate Total Compensation
Next, we'll calculate the total compensation including bonuses:
# Calculate total compensation
df['total_compensation'] = df['base_salary'] + df['bonus_amount']
# Display summary statistics
print("Summary Statistics:")
print(df[['base_salary', 'bonus_amount', 'total_compensation']].describe())
This step shows how to compute total worker compensation, which is crucial for understanding wage impacts on the economy. The summary statistics help us understand the distribution of these values.
Step 4: Analyze Bonus Trends by Company
Let's examine how bonuses vary across different companies:
# Group by company and calculate average bonuses
company_analysis = df.groupby('company').agg({
'base_salary': 'mean',
'bonus_amount': 'mean',
'total_compensation': 'mean'
}).round(2)
print("Average Compensation by Company:")
print(company_analysis)
Understanding company-specific bonus patterns helps identify which firms are driving wage increases in the semiconductor sector. This analysis is similar to what central banks would study when monitoring economic trends.
Step 5: Visualize Wage Distribution
Creating visualizations helps understand the data more clearly:
import matplotlib.pyplot as plt
import seaborn as sns
# Set up the plotting style
plt.style.use('seaborn-v0_8')
fig, axes = plt.subplots(2, 2, figsize=(12, 10))
# Plot 1: Base salary distribution
axes[0,0].hist(df['base_salary'], bins=20, alpha=0.7, color='blue')
axes[0,0].set_title('Base Salary Distribution')
axes[0,0].set_xlabel('Salary ($)')
# Plot 2: Bonus amount distribution
axes[0,1].hist(df['bonus_amount'], bins=20, alpha=0.7, color='green')
axes[0,1].set_title('Bonus Amount Distribution')
axes[0,1].set_xlabel('Bonus ($)')
# Plot 3: Total compensation by company
company_compensation = df.groupby('company')['total_compensation'].mean()
axes[1,0].bar(company_compensation.index, company_compensation.values, color=['red', 'orange', 'yellow', 'purple'])
axes[1,0].set_title('Average Total Compensation by Company')
axes[1,0].set_ylabel('Average Compensation ($)')
axes[1,0].tick_params(axis='x', rotation=45)
# Plot 4: Bonus percentage by year
yearly_bonus = df.groupby('year')['bonus_percentage'].mean()
axes[1,1].plot(yearly_bonus.index, yearly_bonus.values, marker='o', linewidth=2, markersize=8)
axes[1,1].set_title('Average Bonus Percentage Over Time')
axes[1,1].set_ylabel('Average Bonus Percentage')
axes[1,1].set_xlabel('Year')
plt.tight_layout()
plt.show()
Visualizations make it easier to spot patterns and trends in wage data. The charts show how bonuses vary across companies and over time, which is essential for understanding inflationary pressures in the economy.
Step 6: Calculate Inflation Impact Metrics
Now we'll calculate metrics that help understand the potential inflation impact:
# Calculate inflation impact metrics
inflation_metrics = {
'total_bonus_spending': df['bonus_amount'].sum(),
'average_bonus_percentage': df['bonus_percentage'].mean(),
'bonus_to_salary_ratio': df['bonus_amount'].sum() / df['base_salary'].sum(),
'top_10_percent_bonus': df['bonus_amount'].quantile(0.9),
'median_bonus': df['bonus_amount'].median()
}
print("Inflation Impact Metrics:")
for key, value in inflation_metrics.items():
print(f"{key}: {value:.2f}")
These metrics help quantify the economic impact of large bonuses. The bonus-to-salary ratio, for instance, shows how much bonus money is being distributed relative to base salaries, which is a key indicator of wage pressure on the economy.
Step 7: Export Analysis Results
Finally, let's save our analysis for further use:
# Export results to CSV
results_df = pd.DataFrame([inflation_metrics])
results_df.to_csv('chip_worker_bonus_analysis.csv', index=False)
# Export detailed data
df.to_csv('chip_worker_detailed_data.csv', index=False)
print("Analysis results exported successfully!")
Exporting data allows for further analysis, sharing with colleagues, or integration into larger economic models. This step mirrors how central banks might store and share their findings.
Summary
This tutorial demonstrated how to analyze chip worker bonuses and their potential economic impacts using Python. We created sample data representing South Korea's semiconductor industry, calculated total compensation, visualized wage trends, and computed metrics that help understand inflation risks. By working with real-world data patterns, you've learned fundamental data analysis techniques that can be applied to monitor wage trends and economic pressures in various industries. The skills you've learned can be extended to analyze other economic indicators and understand how large payments affect broader economic conditions.



