The aim of this project is to explore the diffeence in earnings based on college majors. This data set is base on students who graduated between 2010 and 2012. The data was collected from American Communinty Survey and was cleaned by FiveThirtyEight. I will be exploring the following questions:
What is the median salary for a college graduate? How do earnings of majors change when there are more women? What is the relationship between majors and number of employed persons in part time work? What is the relationship between majors and number of employed persons in full time work?
import pandas as pd
import matplotlib
%matplotlib inline
The above line of code is a "magic function" that visualises the graph within jupyter notebook without me having to do anything.
recent_grads = pd.read_csv("recent-grads.csv")
recent_grads.iloc[0]
recent_grads.head()
recent_grads.tail()
recent_grads.describe()
raw_data_count = recent_grads.shape[0]
print(raw_data_count)
Above we can see some of the data from the "recent_grads" data set. If we look at the count row we can see that the value is not consistent. We will have to correct this as columns need to be of matching length. The discrepency is most likely due to empty / null values, so we will check for that first.
recent_grads = recent_grads.dropna()
recent_grads.describe()
clean_data_count = recent_grads.shape[0]
print(clean_data_count)
As you can see, the count is now consistently 172 across the board, so it was a case of a null value.
recent_grads.plot(x="Sample_size", y="Median", kind='scatter', xlim=(0,400))
The graph above shows us that there is a relationship between sample size and median. When the sample size was between 0-50 there was a huge range in median salary (20,000 - 110,000). As the sample size increased beyond 50 the Median salary range remained fairly consistent (20,000-60,000).
recent_grads.plot(x="Sample_size", y="Unemployment_rate", kind='scatter', c="red", xlim=(0,500))
The graph above shows that the unemployment range (0.03-0.1) stays fairly consistent as the sample size increases.
recent_grads.plot(x="Full_time", y="Median", kind='scatter', c="purple", xlim=(0,40000))
The graph above shows that as the number of full time workers increase, the median plateaus around $35,000.
recent_grads.plot(x="ShareWomen", y="Unemployment_rate", kind='scatter', c="grey", xlim=(0,1))
The graph above shows that there is no strong relationship between the share of women in a major, and it's unemployment rate.
recent_grads.plot(x="Men", y="Median", kind='scatter', c="pink", xlim=(0,20000))
recent_grads.plot(x="Women", y="Median", kind='scatter', c="black", xlim=(0,30000))
The two graphs above show the median salary of men and women. The data shows that for both groups, the median salary hovers around $35,000.
recent_grads.plot(x="ShareWomen", y="Employed", kind='scatter', c="gold", ylim=(0,20000))
The data shows that as the share of women in majors increases, the number of employed persons has no correlation with it.
recent_grads.plot(x="Employed", y="Low_wage_jobs", kind='scatter', c="green", xlim=(0,50000), ylim=(0,10000))
The data shows that as the share of women increases, the median salary decreases. The rate at which the median salary decreases slows down rapidly after 0.4
recent_grads.plot(x="Employed", y="Median", kind='scatter', c="green", xlim=(0,50000))
recent_grads['Sample_size'].hist(bins=20, range=(100,1000))
recent_grads['Employed'].hist(bins=10, range=(0,50000))
recent_grads['Median'].hist(bins=10, range=(20000,60000))
The data shows that the most common median salary is $35,000
recent_grads['Employed'].hist(bins=15, range=(0,100000))
recent_grads['Full_time'].hist(bins=10, range=(0,50000))
recent_grads['ShareWomen'].hist(bins=10)
recent_grads['Unemployment_rate'].hist(bins=10)
recent_grads['Men'].hist(bins=10, range=(0,38000))
recent_grads['Women'].hist(bins=10, range=(0,50000))
from pandas.plotting import scatter_matrix
scatter_matrix(recent_grads[['Sample_size', 'Median']], figsize=(10,12))
scatter_matrix(recent_grads[['Sample_size', 'Median', "Unemployment_rate"]], figsize=(10,12))
recent_grads[:10]['ShareWomen'].plot.bar()
recent_grads['ShareWomen'][162:].plot.bar()
recent_grads[:10].plot.bar(x='Major', y='ShareWomen')
recent_grads[162:].plot.bar(x='Major', y='ShareWomen')
The data above shows that the share of women is increasingly high amongst majors that involve less math or science.
recent_grads[:10].plot.bar(x='Major', y='Unemployment_rate')
recent_grads[162:].plot.bar(x='Major', y='Unemployment_rate')
recent_grads[:10].plot.bar(x='Major', y='ShareWomen')
The data above shows that chemical engineering, acturial science and astronomy & astrophysics have the highest share of women.
recent_grads[:10].plot.bar(x='Major', y='Full_time')
recent_grads[:10].plot.bar(x='Major', y='Low_wage_jobs')
recent_grads[:10].plot.bar(x='Major', y='Employed')
The data above shows that mechanical, electrical and chemical engineering have the most full time employed persons. It also shows that they have the highest number of low wage workers. However, this makes sense as they have the highest number of employed people.