print("Most billionaires are from the following countries in descending order:")

df['countrycode'].value_counts().head(5)


us = 903 / 1000000000
ger = 160 / 1000000000
china = 153 / 1000000000
russia = 119 / 1000000000
japan = 96 / 1000000000

print("per billion for us is", us, "for germany is", ger, "for china is", china, "for russia is", russia, "for japan is", japan)

"""
Explanation: 1. What country are most billionaires from? For the top ones, how many billionaires per billion people?
End of explanation
"""


df['networthusbillion'].describe()

print("Average wealth of a billionaire is 3.531943")

male = df[df['gender'] == "male"]

male.head()

male['networthusbillion'].describe()

print("The average wealth of male billionaires is 3.516881")

female = df[df['gender'] == "female"]

female['networthusbillion'].describe()

print("The average wealth of female billionaires is 3.819277")

"""
Explanation: 2. What's the average wealth of a billionaire? Male? Female?
End of explanation
"""


print("Most common source of wealth are:")
df['sourceofwealth'].value_counts().head() 
 


print("Most common source of wealth for male billionaires are:")
male['sourceofwealth'].value_counts().head()

print("Most common source of wealth for female billionaires are:")
female['sourceofwealth'].value_counts().head()

"""
Explanation: 3. Most common source of wealth? Male vs. female?
End of explanation
"""


bill =  df.sort_values('networthusbillion', ascending=False).head(10)

df.sort_values('networthusbillion', ascending=False).head(10)

print("A precise list of billionaires, wealth and rank is given below:")
columns_want = bill[['name', 'rank', 'networthusbillion']]
columns_want

"""
Explanation: 4. List top ten billionaires
End of explanation
"""


us_gdp = 7419  

wealth_rich = 76 

percent = round((wealth_rich * 100) / us_gdp)

print(percent, "% of the US GDP is their wealth")

"""
Explanation: 5.Given the richest person in a country, what % of the GDP is their wealth?
End of explanation
"""


print("the most common industries for billionaires to come from are:")
df['industry'].value_counts()

columns_we_want = df[['name', 'networthusbillion', 'industry']]
columns_we_want

print("the total amount of billionaire money from each industry are given below:")
columns_we_want.groupby('industry').describe()

"""
Explanation: 6.What are the most common industries for billionaires to come from? What's the total amount of billionaire money from each industry?
End of explanation
"""


#columnswant = df[['name', 'networthusbillion', 'selfmade']]
#columnswant

print("The number of selfmade billionaires are:")
df['selfmade'].value_counts()

"""
Explanation: 7.How many self made billionaires vs. others?
End of explanation
"""


columns_want = df[['name', 'age', 'selfmade']]
columns_want.head(10)

columns_want = df[['name', 'age', 'industry']]
columns_want.head(10)

columns_want.sort_values('age', ascending=False)

"""
Explanation: 8.How old are billionaires? How old are billionaires self made vs. non self made? or different industries?
End of explanation
"""


is_in_us = df[df['countrycode'] == "USA"]


is_in_us['networthusbillion'].describe()

print("The total wealth of billionaires in US is 903")

"""
Explanation: 9.Add up the wealth of all of the billionaires in a given country (or a few countries) and then compare it to the GDP of the country, so like pit the US vs India
End of explanation
"""


gdp_india = 2066.90

us_bill_wealth = 903

percent = round((us_bill_wealth * 100) / gdp_india)

print(percent, "% of the India GDP is the wealth of US billionaires")

"""
Explanation: Compare the total wealth of billionaires in US to the GDP of the country, so like pit the US vs India¶
End of explanation
"""


df.sort_values('networthusbillion').head(10)

print("The poorest billionaire is")
df.sort_values('networthusbillion').head(1)

"""
Explanation: 10. List top 10 poorest billionaires. Who is the poorest billionare ?
End of explanation
"""


print("The ten youngest billionaires are: ")
df.sort_values('age').head(10)

print("The ten oldest billionaires are: ")

df.sort_values('age', ascending=False).head(10)

columns_want = df[['name', 'age', 'industry']]
columns_want.sort_values('age', ascending=False).head(10)

"""
Explanation: 11. List ten youngest billionaires, list ten oldest billionaires, and plot and age distribution graph
End of explanation
"""


import matplotlib.pyplot as plt

%matplotlib inline

df.plot(kind='scatter', x='age', y='networthusbillion')

"""
Explanation: 11b. Plot an age distribution graph
End of explanation
"""


print("The most common relationships are:")
df['relationshiptocompany'].value_counts().head() 
 

print("Relationship to a company is describes the billionaire's relationship to the company primarily responsible for their wealth, such as founder, executive, relation, or shareholder")


"""
Explanation: 12. What is relationship to company? And what are the most common relationships?
End of explanation
"""


columnswant

sort_df = df.sort_values('networthusbillion')

sort_df.plot(kind='line', x='rank', y='networthusbillion')

df.plot(kind='bar', x='name', y='networthusbillion')

"""
Explanation: 13.Maybe just made a graph about how wealthy they are in general?
End of explanation
"""


df.plot(kind='scatter', x='age', y='networthusbillion')

"""
Explanation: 14.Maybe plot their net worth vs age (scatterplot)
End of explanation
"""


df['networthusbillion'].head(10).plot(kind='bar', x='name', y='networthusbillion')


"""
Explanation: 15.Make a bar graph of the top 10 or 20 richest
End of explanation
"""


