├── Figure_1.png ├── Figure_2.png ├── Figure_3.png ├── Figure_4.png ├── Figure_5.png ├── analysis.py ├── cleanedDataset.py ├── cleaned_mental_illnesses.csv └── mentalillnesses.csv /Figure_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/assistantmanager30/Python-project/9e2779c3039b5ca887483868490355c2009d634d/Figure_1.png -------------------------------------------------------------------------------- /Figure_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/assistantmanager30/Python-project/9e2779c3039b5ca887483868490355c2009d634d/Figure_2.png -------------------------------------------------------------------------------- /Figure_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/assistantmanager30/Python-project/9e2779c3039b5ca887483868490355c2009d634d/Figure_3.png -------------------------------------------------------------------------------- /Figure_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/assistantmanager30/Python-project/9e2779c3039b5ca887483868490355c2009d634d/Figure_4.png -------------------------------------------------------------------------------- /Figure_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/assistantmanager30/Python-project/9e2779c3039b5ca887483868490355c2009d634d/Figure_5.png -------------------------------------------------------------------------------- /analysis.py: -------------------------------------------------------------------------------- 1 | #OBJECTIVE 1:- 2 | import pandas as pd 3 | import matplotlib.pyplot as plt 4 | import seaborn as sns 5 | 6 | # Load the dataset 7 | df = pd.read_csv("cleaned_mental_illnesses.csv") 8 | 9 | # Filter for India 10 | india_df = df[df['Country'] == 'India'] 11 | 12 | # Plot 13 | plt.figure(figsize=(10, 6)) 14 | sns.lineplot(data=india_df, x='Year', y='Depression (%)', marker='o') 15 | plt.title('Depression Prevalence in India Over Time') 16 | plt.ylabel('Depression (%)') 17 | plt.xlabel('Year') 18 | plt.grid(True) 19 | plt.tight_layout() 20 | plt.show() 21 | 22 | #OBJECTIVE 2:- 23 | # Filter for the year 2019 24 | df_2019 = df[df['Year'] == 2019] 25 | 26 | # Disorder columns 27 | disorders = ['Schizophrenia (%)', 'Depression (%)', 'Anxiety (%)', 'Bipolar (%)', 'Eating Disorders (%)'] 28 | avg_disorders_2019 = df_2019[disorders].mean().sort_values() 29 | 30 | # Plot 31 | plt.figure(figsize=(10, 6)) 32 | sns.barplot(x=avg_disorders_2019.values, y=avg_disorders_2019.index, palette="mako") 33 | plt.title('Average Global Prevalence of Mental Illnesses in 2019') 34 | plt.xlabel('Average Prevalence (%)') 35 | plt.tight_layout() 36 | plt.show() 37 | 38 | #OBJECTIVE 3:- 39 | # Sort countries by Anxiety prevalence in 2019 40 | top_anxiety = df_2019[['Country', 'Anxiety (%)']].sort_values(by='Anxiety (%)', ascending=False).head(10) 41 | 42 | # Plot 43 | plt.figure(figsize=(10, 6)) 44 | sns.barplot(x='Anxiety (%)', y='Country', data=top_anxiety, palette="rocket") 45 | plt.title('Top 10 Countries with Highest Anxiety Rates in 2019') 46 | plt.xlabel('Anxiety Prevalence (%)') 47 | plt.tight_layout() 48 | plt.show() 49 | 50 | #OBJECTIVE 4:- 51 | # Correlation heatmap 52 | plt.figure(figsize=(10, 6)) 53 | corr = df[disorders].corr() 54 | sns.heatmap(corr, annot=True, cmap='coolwarm', fmt='.2f') 55 | plt.title('Correlation Between Different Mental Illnesses') 56 | plt.tight_layout() 57 | plt.show() 58 | 59 | #OBJECTIVE 5:- 60 | # Plot distribution of depression rates globally 61 | plt.figure(figsize=(10, 6)) 62 | sns.histplot(df_2019['Depression (%)'], bins=20, kde=True, color='skyblue') 63 | plt.title('Global Distribution of Depression Rates in 2019') 64 | plt.xlabel('Depression Prevalence (%)') 65 | plt.tight_layout() 66 | plt.show() 67 | -------------------------------------------------------------------------------- /cleanedDataset.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | 3 | # Load the dataset 4 | file_path = "1- C:/Users/Dell/OneDrive/Desktop/python project/mentalIllness.csv" 5 | df = pd.read_csv(file_path) 6 | 7 | # Renaming columns for better readability 8 | df_cleaned = df.rename(columns={ 9 | "Entity": "Country", 10 | "Code": "Country_Code", 11 | "Year": "Year", 12 | "Schizophrenia disorders (share of population) - Sex: Both - Age: Age-standardized": "Schizophrenia (%)", 13 | "Depressive disorders (share of population) - Sex: Both - Age: Age-standardized": "Depression (%)", 14 | "Anxiety disorders (share of population) - Sex: Both - Age: Age-standardized": "Anxiety (%)", 15 | "Bipolar disorders (share of population) - Sex: Both - Age: Age-standardized": "Bipolar (%)", 16 | "Eating disorders (share of population) - Sex: Both - Age: Age-standardized": "Eating Disorders (%)", 17 | }) 18 | 19 | # Handling missing values in 'Country_Code' (fill with 'Unknown' for now) 20 | df_cleaned["Country_Code"].fillna("Unknown", inplace=True) 21 | 22 | # Removing duplicate rows (if any) 23 | df_cleaned.drop_duplicates(inplace=True) 24 | 25 | # Save the cleaned dataset 26 | cleaned_file_path = "cleaned_mental_illnesses.csv" 27 | df_cleaned.to_csv(cleaned_file_path, index=False) 28 | 29 | print(f"Cleaned dataset saved as {cleaned_file_path}") 30 | 31 | --------------------------------------------------------------------------------