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?

In [1]:
import pandas as pd
import matplotlib

In [2]:
%matplotlib inline


The above line of code is a "magic function" that visualises the graph within jupyter notebook without me having to do anything.

In [3]:
recent_grads = pd.read_csv("recent-grads.csv")

In [4]:
recent_grads.iloc[0]

Out[4]:
Rank                                        1
Major_code                               2419
Major                   PETROLEUM ENGINEERING
Total                                    2339
Men                                      2057
Women                                     282
Major_category                    Engineering
ShareWomen                           0.120564
Sample_size                                36
Employed                                 1976
Full_time                                1849
Part_time                                 270
Full_time_year_round                     1207
Unemployed                                 37
Unemployment_rate                   0.0183805
Median                                 110000
P25th                                   95000
P75th                                  125000
College_jobs                             1534
Non_college_jobs                          364
Low_wage_jobs                             193
Name: 0, dtype: object
In [5]:
recent_grads.head()

Out[5]:
Rank Major_code Major Total Men Women Major_category ShareWomen Sample_size Employed ... Part_time Full_time_year_round Unemployed Unemployment_rate Median P25th P75th College_jobs Non_college_jobs Low_wage_jobs
0 1 2419 PETROLEUM ENGINEERING 2339.0 2057.0 282.0 Engineering 0.120564 36 1976 ... 270 1207 37 0.018381 110000 95000 125000 1534 364 193
1 2 2416 MINING AND MINERAL ENGINEERING 756.0 679.0 77.0 Engineering 0.101852 7 640 ... 170 388 85 0.117241 75000 55000 90000 350 257 50
2 3 2415 METALLURGICAL ENGINEERING 856.0 725.0 131.0 Engineering 0.153037 3 648 ... 133 340 16 0.024096 73000 50000 105000 456 176 0
3 4 2417 NAVAL ARCHITECTURE AND MARINE ENGINEERING 1258.0 1123.0 135.0 Engineering 0.107313 16 758 ... 150 692 40 0.050125 70000 43000 80000 529 102 0
4 5 2405 CHEMICAL ENGINEERING 32260.0 21239.0 11021.0 Engineering 0.341631 289 25694 ... 5180 16697 1672 0.061098 65000 50000 75000 18314 4440 972

5 rows × 21 columns

In [6]:
recent_grads.tail()

Out[6]:
Rank Major_code Major Total Men Women Major_category ShareWomen Sample_size Employed ... Part_time Full_time_year_round Unemployed Unemployment_rate Median P25th P75th College_jobs Non_college_jobs Low_wage_jobs
168 169 3609 ZOOLOGY 8409.0 3050.0 5359.0 Biology & Life Science 0.637293 47 6259 ... 2190 3602 304 0.046320 26000 20000 39000 2771 2947 743
169 170 5201 EDUCATIONAL PSYCHOLOGY 2854.0 522.0 2332.0 Psychology & Social Work 0.817099 7 2125 ... 572 1211 148 0.065112 25000 24000 34000 1488 615 82
170 171 5202 CLINICAL PSYCHOLOGY 2838.0 568.0 2270.0 Psychology & Social Work 0.799859 13 2101 ... 648 1293 368 0.149048 25000 25000 40000 986 870 622
171 172 5203 COUNSELING PSYCHOLOGY 4626.0 931.0 3695.0 Psychology & Social Work 0.798746 21 3777 ... 965 2738 214 0.053621 23400 19200 26000 2403 1245 308
172 173 3501 LIBRARY SCIENCE 1098.0 134.0 964.0 Education 0.877960 2 742 ... 237 410 87 0.104946 22000 20000 22000 288 338 192

5 rows × 21 columns

In [7]:
recent_grads.describe()

Out[7]:
Rank Major_code Total Men Women ShareWomen Sample_size Employed Full_time Part_time Full_time_year_round Unemployed Unemployment_rate Median P25th P75th College_jobs Non_college_jobs Low_wage_jobs
count 173.000000 173.000000 172.000000 172.000000 172.000000 172.000000 173.000000 173.000000 173.000000 173.000000 173.000000 173.000000 173.000000 173.000000 173.000000 173.000000 173.000000 173.000000 173.000000
mean 87.000000 3879.815029 39370.081395 16723.406977 22646.674419 0.522223 356.080925 31192.763006 26029.306358 8832.398844 19694.427746 2416.329480 0.068191 40151.445087 29501.445087 51494.219653 12322.635838 13284.497110 3859.017341
std 50.084928 1687.753140 63483.491009 28122.433474 41057.330740 0.231205 618.361022 50675.002241 42869.655092 14648.179473 33160.941514 4112.803148 0.030331 11470.181802 9166.005235 14906.279740 21299.868863 23789.655363 6944.998579
min 1.000000 1100.000000 124.000000 119.000000 0.000000 0.000000 2.000000 0.000000 111.000000 0.000000 111.000000 0.000000 0.000000 22000.000000 18500.000000 22000.000000 0.000000 0.000000 0.000000
25% 44.000000 2403.000000 4549.750000 2177.500000 1778.250000 0.336026 39.000000 3608.000000 3154.000000 1030.000000 2453.000000 304.000000 0.050306 33000.000000 24000.000000 42000.000000 1675.000000 1591.000000 340.000000
50% 87.000000 3608.000000 15104.000000 5434.000000 8386.500000 0.534024 130.000000 11797.000000 10048.000000 3299.000000 7413.000000 893.000000 0.067961 36000.000000 27000.000000 47000.000000 4390.000000 4595.000000 1231.000000
75% 130.000000 5503.000000 38909.750000 14631.000000 22553.750000 0.703299 338.000000 31433.000000 25147.000000 9948.000000 16891.000000 2393.000000 0.087557 45000.000000 33000.000000 60000.000000 14444.000000 11783.000000 3466.000000
max 173.000000 6403.000000 393735.000000 173809.000000 307087.000000 0.968954 4212.000000 307933.000000 251540.000000 115172.000000 199897.000000 28169.000000 0.177226 110000.000000 95000.000000 125000.000000 151643.000000 148395.000000 48207.000000
In [8]:
raw_data_count = recent_grads.shape[0]
print(raw_data_count)

173


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.

In [9]:
 recent_grads = recent_grads.dropna()

In [10]:
recent_grads.describe()

Out[10]:
Rank Major_code Total Men Women ShareWomen Sample_size Employed Full_time Part_time Full_time_year_round Unemployed Unemployment_rate Median P25th P75th College_jobs Non_college_jobs Low_wage_jobs
count 172.000000 172.000000 172.000000 172.000000 172.000000 172.000000 172.000000 172.00000 172.000000 172.000000 172.000000 172.000000 172.000000 172.000000 172.000000 172.000000 172.000000 172.000000 172.000000
mean 87.377907 3895.953488 39370.081395 16723.406977 22646.674419 0.522223 357.941860 31355.80814 26165.767442 8877.232558 19798.843023 2428.412791 0.068024 40076.744186 29486.918605 51386.627907 12387.401163 13354.325581 3878.633721
std 49.983181 1679.240095 63483.491009 28122.433474 41057.330740 0.231205 619.680419 50777.42865 42957.122320 14679.038729 33229.227514 4121.730452 0.030340 11461.388773 9190.769927 14882.278650 21344.967522 23841.326605 6960.467621
min 1.000000 1100.000000 124.000000 119.000000 0.000000 0.000000 2.000000 0.00000 111.000000 0.000000 111.000000 0.000000 0.000000 22000.000000 18500.000000 22000.000000 0.000000 0.000000 0.000000
25% 44.750000 2403.750000 4549.750000 2177.500000 1778.250000 0.336026 42.000000 3734.75000 3181.000000 1013.750000 2474.750000 299.500000 0.050261 33000.000000 24000.000000 41750.000000 1744.750000 1594.000000 336.750000
50% 87.500000 3608.500000 15104.000000 5434.000000 8386.500000 0.534024 131.000000 12031.50000 10073.500000 3332.500000 7436.500000 905.000000 0.067544 36000.000000 27000.000000 47000.000000 4467.500000 4603.500000 1238.500000
75% 130.250000 5503.250000 38909.750000 14631.000000 22553.750000 0.703299 339.000000 31701.25000 25447.250000 9981.000000 17674.750000 2397.000000 0.087247 45000.000000 33250.000000 58500.000000 14595.750000 11791.750000 3496.000000
max 173.000000 6403.000000 393735.000000 173809.000000 307087.000000 0.968954 4212.000000 307933.00000 251540.000000 115172.000000 199897.000000 28169.000000 0.177226 110000.000000 95000.000000 125000.000000 151643.000000 148395.000000 48207.000000
In [11]:
clean_data_count = recent_grads.shape[0]
print(clean_data_count)

172


As you can see, the count is now consistently 172 across the board, so it was a case of a null value.

In [12]:
recent_grads.plot(x="Sample_size", y="Median", kind='scatter', xlim=(0,400))

Out[12]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f680f3814e0>

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).

In [13]:
recent_grads.plot(x="Sample_size", y="Unemployment_rate", kind='scatter', c="red", xlim=(0,500))

Out[13]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f680f35a6a0>

The graph above shows that the unemployment range (0.03-0.1) stays fairly consistent as the sample size increases.

In [14]:
recent_grads.plot(x="Full_time", y="Median", kind='scatter', c="purple", xlim=(0,40000))

Out[14]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f680f36f630>

The graph above shows that as the number of full time workers increase, the median plateaus around $35,000. In [15]: recent_grads.plot(x="ShareWomen", y="Unemployment_rate", kind='scatter', c="grey", xlim=(0,1))  Out[15]: <matplotlib.axes._subplots.AxesSubplot at 0x7f680d2284a8> The graph above shows that there is no strong relationship between the share of women in a major, and it's unemployment rate. In [16]: recent_grads.plot(x="Men", y="Median", kind='scatter', c="pink", xlim=(0,20000))  Out[16]: <matplotlib.axes._subplots.AxesSubplot at 0x7f680d2040f0> In [17]: recent_grads.plot(x="Women", y="Median", kind='scatter', c="black", xlim=(0,30000))  Out[17]: <matplotlib.axes._subplots.AxesSubplot at 0x7f680d1640b8> 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.

In [40]:
recent_grads.plot(x="ShareWomen", y="Employed", kind='scatter', c="gold", ylim=(0,20000))

Out[40]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f680aa8cc50>

The data shows that as the share of women in majors increases, the number of employed persons has no correlation with it.

In [58]:
recent_grads.plot(x="Employed", y="Low_wage_jobs", kind='scatter', c="green", xlim=(0,50000), ylim=(0,10000))

Out[58]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f680a1753c8>

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

In [51]:
recent_grads.plot(x="Employed", y="Median", kind='scatter', c="green", xlim=(0,50000))

Out[51]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f680a3dd0f0>
In [19]:
recent_grads['Sample_size'].hist(bins=20, range=(100,1000))

Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f680d0a5208>
In [20]:
recent_grads['Employed'].hist(bins=10, range=(0,50000))

Out[20]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f680d091828>
In [21]:
recent_grads['Median'].hist(bins=10, range=(20000,60000))

Out[21]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f680cfc9da0>

The data shows that the most common median salary is \$35,000

In [22]:
recent_grads['Employed'].hist(bins=15, range=(0,100000))

Out[22]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f680cf9d550>
In [23]:
recent_grads['Full_time'].hist(bins=10, range=(0,50000))

Out[23]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f680cead978>
In [24]:
recent_grads['ShareWomen'].hist(bins=10)

Out[24]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f680cde4828>
In [25]:
recent_grads['Unemployment_rate'].hist(bins=10)

Out[25]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f680cd6beb8>
In [26]:
recent_grads['Men'].hist(bins=10, range=(0,38000))

Out[26]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f680cceea90>
In [27]:
recent_grads['Women'].hist(bins=10, range=(0,50000))

Out[27]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f680cbdbc18>
In [28]:
from pandas.plotting import scatter_matrix

In [29]:
scatter_matrix(recent_grads[['Sample_size', 'Median']], figsize=(10,12))

Out[29]:
array([[<matplotlib.axes._subplots.AxesSubplot object at 0x7f680cc0eb70>,
<matplotlib.axes._subplots.AxesSubplot object at 0x7f680cb44e48>],
[<matplotlib.axes._subplots.AxesSubplot object at 0x7f680ca940b8>,
<matplotlib.axes._subplots.AxesSubplot object at 0x7f680caca550>]],
dtype=object)
In [30]:
scatter_matrix(recent_grads[['Sample_size', 'Median', "Unemployment_rate"]], figsize=(10,12))

Out[30]:
array([[<matplotlib.axes._subplots.AxesSubplot object at 0x7f680cab0470>,
<matplotlib.axes._subplots.AxesSubplot object at 0x7f680c966fd0>,
<matplotlib.axes._subplots.AxesSubplot object at 0x7f680c933978>],
[<matplotlib.axes._subplots.AxesSubplot object at 0x7f680c8f24e0>,
<matplotlib.axes._subplots.AxesSubplot object at 0x7f680c8ba710>,
<matplotlib.axes._subplots.AxesSubplot object at 0x7f680c862518>],
[<matplotlib.axes._subplots.AxesSubplot object at 0x7f680c82ff60>,
<matplotlib.axes._subplots.AxesSubplot object at 0x7f680c8402e8>,
<matplotlib.axes._subplots.AxesSubplot object at 0x7f680c7be668>]],
dtype=object)
In [31]:
recent_grads[:10]['ShareWomen'].plot.bar()

Out[31]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f680c6c1b00>
In [32]:
recent_grads['ShareWomen'][162:].plot.bar()

Out[32]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f680c627518>
In [33]:
recent_grads[:10].plot.bar(x='Major', y='ShareWomen')

Out[33]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f680ad9bba8>
In [34]:
recent_grads[162:].plot.bar(x='Major', y='ShareWomen')

Out[34]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f680ad27940>

The data above shows that the share of women is increasingly high amongst majors that involve less math or science.

In [35]:
recent_grads[:10].plot.bar(x='Major', y='Unemployment_rate')

Out[35]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f680acc2b70>
In [36]:
recent_grads[162:].plot.bar(x='Major', y='Unemployment_rate')

Out[36]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f680ac4ceb8>
In [41]:
recent_grads[:10].plot.bar(x='Major', y='ShareWomen')

Out[41]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f680a998320>

The data above shows that chemical engineering, acturial science and astronomy & astrophysics have the highest share of women.

In [46]:
recent_grads[:10].plot.bar(x='Major', y='Full_time')

Out[46]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f680a5f07b8>
In [47]:
recent_grads[:10].plot.bar(x='Major', y='Low_wage_jobs')

Out[47]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f680a7a9668>
In [48]:
recent_grads[:10].plot.bar(x='Major', y='Employed')

Out[48]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f680a79a1d0>

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.