You are on page 1of 9

SUBMITTED BY: PARTH SARAOGI (18SCSE1010348)

QUES 46:
Introduction
The suicide rate in lots of countries have been quite high for many years, including the
developing and developed countries. At the beginning, we'll see the suicide rate of sex, and then
the age and generation. Next we'll plot the rank of suicide rate, it's clearly to understand the
distribution of the suicide rate. Finally, we'll find out the key factors of high suicide rate.

import seaborn as sns


import matplotlib.pyplot as plt
import numpy as np
import os
import pandas as pd
from scipy import stats
import pycountry
import geopandas

Rearrange the dataset

df["gdp_for_year"] = df["gdp_for_year"].str.replace(",","").astype(np.int64)
df["age"] = df["age"].str.replace("5-14 years","05-14 years")

Let's see the performance of sex.


df_men = df[df.sex == "male"]
df_women = df[df.sex == "female"]
sns.lineplot(df_men.year, df.suicides_no, ci = None)
sns.lineplot(df_women.year, df.suicides_no, ci = None)
plt.legend(["male", 'female'])
plt.show()
No matter which year it is, the suicides number of male are about three times higher than of
female. How about the age?
df_age = df.groupby(["year","age"])["suicides_no", "population"].sum()
df_reset = df_age.copy().reset_index()
plt.figure(figsize=(9,6))
sns.lineplot("year", df_reset.suicides_no*100/df_reset.population, hue = "age",
data = df_reset, linewidth = 2.5, style = "age", markers=True
, dashes=False)
plt.xticks(rotation = 90)
plt.show()
Obviously, the suicide rate is getting higher when the age is higher. That is, age is a factor of
suicide.
df_generation = df.groupby(["year", "generation"])["suicides_no", "population"].sum()
df_generation_reset = df_generation.copy().reset_index()
plt.figure(figsize=(9,6))
sns.lineplot("year", df_generation_reset.suicides_no*100/df_generation_reset.population, hue =
"generation",
data = df_generation_reset, linewidth = 2.5, style = "generation", markers=True
, dashes=False)
plt.xticks(rotation = 90)
plt.show()
Before 2000, we can see that the highest suicide rate is G.I. generation, and this generation is
also known as WW2 generation. They suffered from the worldwide great depression before
WW2, at this time, the income, profit, taxes are decreased seriously, so this generation
experienced economic and social turmoil.
Did this kind of social impact affect the suicide rate of G.I. generation? Compare to the Silent
generation after 2000, the suicide rate is not that high.

Interestingly, the suicide rate of Generation X and Millenials increase step by step. Besides, the
suicide rate increases rapidly once the average age of generation is over 20. Does it mean that the
suicide rate of young persons rise when they are independent of their parents? In other words,
healthy family is helpful to the suicide rate. Let's take a look.

We arrange the country list and see how many countries are in the dataset, then calculate the
suicide rate of countries.
df1 = df.groupby("country")["suicides_no"].sum()
country_name = list(df1.index.get_level_values(0))
len(country_name)
country_dict={}
for country in df_total.index.get_level_values(0):
if country not in country_dict.keys():
country_dict[country] = df_total[country].mean()
else:
pass
tup = list(country_dict.items())
tup.sort(key= lambda pair:pair[1], reverse = True)
country_list = [a[0] for a in tup]
country_suicide = [a[1] for a in tup]

plt.figure(figsize=(8,32))
sns.barplot(x=country_suicide[:],y=country_list[:], palette="GnBu")
plt.xlabel("ratio of suicide")
plt.ylabel("country")
plt.title("suicide rate vs country")
plt.show()
plt.figure(figsize = (9,6))
for country in country_list[:10]:
plt.plot(df_total[country].index,df_total[country].values, label=country, marker="o")
plt.xlabel("year")
plt.ylabel("ratio of suicide")
plt.legend()
plt.show()

It's clearly that the suicide rate of some top10 countries dramatically increased after 1990. In
addition, the rate in others are still high during 1990 to 2000. The transition to the economy and
democracy in former Soviet Union countries may be the main reasons. Although there have been
numerous studies of the increase in mortality, such as alcoholism, economic hardship,
despression and so on, but there is still no one accepted as the most significant factor of the
mortality crisis. 

Suicides number has increased or decreased

Age group commiting more suicides


Men or women who commits more suicide.

Which age group among male and female commit more suicide

You might also like