Upload 676_252_1434_72.py
Browse files- 676_252_1434_72.py +57 -0
676_252_1434_72.py
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# -*- coding: utf-8 -*-
|
2 |
+
"""676_252_1434_72
|
3 |
+
|
4 |
+
Automatically generated by Colab.
|
5 |
+
|
6 |
+
Original file is located at
|
7 |
+
https://colab.research.google.com/drive/1FniZJX1OfI1PltPCXhpw50znN1aYMFcP
|
8 |
+
"""
|
9 |
+
|
10 |
+
import numpy as np
|
11 |
+
import pandas as pd
|
12 |
+
|
13 |
+
import os
|
14 |
+
for dirname, _, filenames in os.walk('/content/world_bank_data_2025.csv'):
|
15 |
+
for filename in filenames:
|
16 |
+
print(os.path.join(dirname, filename))
|
17 |
+
|
18 |
+
import pandas as pd
|
19 |
+
import seaborn as sns
|
20 |
+
import matplotlib.pyplot as plt
|
21 |
+
|
22 |
+
df = pd.read_csv('/content/world_bank_data_2025.csv')
|
23 |
+
df.head()
|
24 |
+
|
25 |
+
print("Shape of dataset:", df.shape)
|
26 |
+
print("COlumns:\n", df.columns.tolist())
|
27 |
+
print("\nMissing values:\n", df.isnull().sum())
|
28 |
+
df.dtypes
|
29 |
+
|
30 |
+
indicators = df.columns.difference(['country_name', 'country_id', 'year'])
|
31 |
+
df_clean = df.dropna(subset=indicators, how='all')
|
32 |
+
|
33 |
+
top_countries = df_clean.groupby('country_name')['GDP (Current USD)'].mean().nlargest(10).index
|
34 |
+
gdp_plot = df_clean[df_clean['country_name'].isin(top_countries)]
|
35 |
+
|
36 |
+
plt.figure(figsize=(12, 6))
|
37 |
+
sns.lineplot(data=gdp_plot, x='year', y='GDP (Current USD)', hue='country_name')
|
38 |
+
plt.title('GDP Trends (Top 10 Countries by Avg GDP)')
|
39 |
+
plt.ylabel('GDP in USD')
|
40 |
+
plt.xticks(rotation=45)
|
41 |
+
plt.grid(True)
|
42 |
+
plt.tight_layout()
|
43 |
+
plt.show()
|
44 |
+
|
45 |
+
numeric_df = df_clean.select_dtypes(include=['number']).drop(columns=['year'])
|
46 |
+
plt.figure(figsize=(10, 8))
|
47 |
+
sns.heatmap(numeric_df.corr(), annot=True, cmap='coolwarm', fmt='.2f')
|
48 |
+
plt.title('Correlation Between Economic Indicators')
|
49 |
+
plt.show()
|
50 |
+
|
51 |
+
inflation_2020 = df_clean[df_clean['year'] == 2020]
|
52 |
+
plt.figure(figsize=(12, 5))
|
53 |
+
sns.histplot(inflation_2020['Inflation (CPI %)'].dropna(), bins=30, kde=True, color='orange')
|
54 |
+
plt.title('Inflation Rate Distribution - 2020')
|
55 |
+
plt.xlabel('Inflation (CPI %)')
|
56 |
+
plt.grid(True)
|
57 |
+
plt.show()
|