df.head(3)

df.columns

recent = df[df['year']==2014]
recent.head()

df['citizenship'].value_counts().head(5)
#I am going to skip the second part of the question
#because we would have to create a new column with the number of people per country. Easier joining tables?

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


recent.sort_values(by='rank').head(10)

"""
Explanation: 2)Who are the top 10 richest billionaires?
End of explanation
"""


recent['networthusbillion'].describe()

females = recent[recent['gender'] == 'female']
males = recent[recent['gender'] == 'male']

females['networthusbillion'].describe()



males['networthusbillion'].describe()






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


recent.sort_values(by='rank').tail(1)

recent.sort_values(by='rank').tail(10)

"""
Explanation: 4)Who is the poorest billionaire? Who are the top 10 poorest billionaires?
End of explanation
"""


recent['relationshiptocompany'].value_counts().head(10)

"""
Explanation: 5)'What is relationship to company'? And what are the most common relationships?
End of explanation
"""


recent['sourceofwealth'].value_counts().head(10)

females = recent[recent['gender'] == 'female']
males = recent[recent['gender'] == 'male']

females['sourceofwealth'].value_counts().head(10)


males['sourceofwealth'].value_counts().head(10)

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


recent['industry'].value_counts().head(10)

recent.groupby('industry')['networthusbillion'].sum()

"""
Explanation: 9)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
"""


recent['selfmade'].value_counts()

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


billionaires_age = ['name', 'age']
recent[billionaires_age]



recent.groupby('selfmade')['age'].describe()

recent.groupby('industry')['age'].describe()

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


recent.sort_values('age', ascending=True).head(10)

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

import matplotlib.pyplot as plt


%matplotlib inline

import matplotlib.pyplot as plt
plt.style.available

plt.style.use('dark_background')
young_age_ordered = recent.sort_values('age', ascending=True).head(10)
young_age_ordered.plot(kind='scatter', x='age', y='networthusbillion')
#oops misread instructions


old_age_ordered = recent.sort_values('age', ascending=False).head(10)
old_age_ordered.plot(kind='scatter', x='age', y='networthusbillion')

#oops misread instructions



plt.style.use('seaborn-bright')
age_distribution = recent['age'].value_counts()
age_distribution.describe()
age_distribution.head(30).plot(kind='bar', x='', y='') #i am not sure how to comple x,y fields in this case

"""
Explanation: 12)Who are the youngest billionaires? The oldest? Age distribution - maybe make a graph about it?
End of explanation
"""



recent.plot(kind='bar', x='name', y='networthusbillion')
#I know this is awful but looks cool lol

ordered_by_wealth = recent.sort_values('networthusbillion', ascending=False)
ordered_by_wealth.head(30).plot(kind='bar', x='rank', y='networthusbillion', color=['g'])

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


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

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


top_10 = recent.sort_values(by='networthusbillion', ascending=False).head(10)

top_10.plot(kind='barh', x='name', y='networthusbillion', color="r")

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


