Professional Documents
Culture Documents
Submitted By: Parth Saraogi (18scse1010348) QUES 46
Submitted By: Parth Saraogi (18scse1010348) QUES 46
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.
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")
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.
Which age group among male and female commit more suicide