Visualizing Earnings Based On College Majors

The dataset on includes information job outcomes of students who graduated from college between 2010 and 2012. The original data on job outcomes was released by American Community Survey, which conducts surveys and aggregates the data. FiveThirtyEight cleaned the dataset and released it on their Github repo.

Each row in the dataset represents a different major in college and contains information on gender diversity, employment rates, median salaries, and more. The dataset columns are:

  • Rank: Rank by median earnings
  • Major_code: Major code, FO1DP in ACS PUMS
  • Major: Major description
  • Major_category: Category of major from Carnevale et al
  • Total: Total number of people with major
  • Sample_size: Sample size (unweighted) of full-time, year-round ONLY (used for earnings)
  • Men: Male graduates
  • Women: Female graduates
  • ShareWomen: Women as share of total
  • Employed: Number employed (ESR == 1 or 2)
  • Full_time: Employed 35 hours or more
  • Part_time: Employed less than 35 hours
  • Full_time_year_round: Employed at least 50 weeks (WKW == 1) and at least 35 hours (WKHP >= 35)
  • Unemployed: Number unemployed (ESR == 3)
  • Unemployment_rate: Unemployed / (Unemployed + Employed)
  • Median: Median earnings of full-time, year-round workers
  • P25th: 25th percentile of earnings
  • P75th: 75th percentile of earnings
  • College_jobs: Number with job requiring a college degree
  • Non_college_jobs: Number with job not requiring a college degree
  • Low_wage_jobs: Number in low-wage service jobs

Objectives

Using the different pandas plotting function to do an analysis of this dataset, will make us interpret and answer the following objectives:

  • See if students in more popular majors make more money
  • See how many majors are predominantly male and predominantly female
  • See which category of majors have the most students
In [1]:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from pandas.plotting import scatter_matrix

%matplotlib inline
In [2]:
recent_grads = pd.read_csv("recent-grads.csv")
recent_grads
Out[2]:
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
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
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

173 rows × 21 columns

Cleaning the Dataset

In [3]:
recent_grads.iloc[0]
Out[3]:
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 [4]:
recent_grads.head(5)
Out[4]:
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 [5]:
recent_grads.tail(5)
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
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 [6]:
recent_grads.describe()
Out[6]:
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 [7]:
recent_grads.shape
Out[7]:
(173, 21)
In [8]:
raw_data_count = recent_grads.shape[0]
raw_data_count
Out[8]:
173

The dataset has 173 rows and 21 columns.

In [9]:
recent_grads.isnull().sum()
Out[9]:
Rank                    0
Major_code              0
Major                   0
Total                   1
Men                     1
Women                   1
Major_category          0
ShareWomen              1
Sample_size             0
Employed                0
Full_time               0
Part_time               0
Full_time_year_round    0
Unemployed              0
Unemployment_rate       0
Median                  0
P25th                   0
P75th                   0
College_jobs            0
Non_college_jobs        0
Low_wage_jobs           0
dtype: int64

The columns Total, Men, Women, and ShareWomen contain 1 row with null values.

In [10]:
recent_grads = recent_grads.dropna()
recent_grads
Out[10]:
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
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
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

172 rows × 21 columns

In [11]:
recent_grads.isnull().sum()
Out[11]:
Rank                    0
Major_code              0
Major                   0
Total                   0
Men                     0
Women                   0
Major_category          0
ShareWomen              0
Sample_size             0
Employed                0
Full_time               0
Part_time               0
Full_time_year_round    0
Unemployed              0
Unemployment_rate       0
Median                  0
P25th                   0
P75th                   0
College_jobs            0
Non_college_jobs        0
Low_wage_jobs           0
dtype: int64
In [12]:
cleaned_data_count = recent_grads.shape[0]
cleaned_data_count
Out[12]:
172

After removing the rows with null values, the dataset contains 172 rows from the total 173 rows.

In [13]:
recent_grads.columns
Out[13]:
Index(['Rank', 'Major_code', 'Major', 'Total', 'Men', 'Women',
       'Major_category', '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'],
      dtype='object')
In [14]:
columns_names = ['rank', 'major_code', 'major', 'total', 'men', 'women',
       'major_category', 'share_women', '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']
In [15]:
recent_grads.columns = columns_names
recent_grads.head(5)
Out[15]:
rank major_code major total men women major_category share_women 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

The columns where changed from no format to snakecase following the Python standards.

Dataset Analysis

To get an answer for each objective, we are going to generate different types of plots to get answers.

Scatter Plots

First of all we are going to genereate __Scatter Plots__ comparing different relations.

In [16]:
ax = recent_grads.plot(x="sample_size", y="median", kind="scatter", color="blue", figsize=(20, 7))
ax.set_title("Sample Size - Median")
ax.set_xlabel("Sample Size", size=12)
ax.set_ylabel("Median", size=12)
Out[16]:
Text(0, 0.5, 'Median')
In [69]:
recent_grads.plot.hexbin(x = "sample_size", y = "median", title = "Sample Size - Median", 
                         gridsize = (15), figsize = (20,10), colormap = 'seismic', sharex=False, rot = 90)
Out[69]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f93381722d0>
In [17]:
ax = recent_grads.plot(x="sample_size", y="unemployment_rate", kind="scatter", color="blue", figsize=(20, 7))
ax.set_title("Sample Size - Unemployment Rate")
ax.set_xlabel("Sample Size", size=12)
ax.set_ylabel("Unemployment Rate", size=12)
Out[17]:
Text(0, 0.5, 'Unemployment Rate')
In [18]:
ax = recent_grads.plot(x="full_time", y="median", kind="scatter", color="blue", figsize=(20, 7))
ax.set_title("Full Time - Median")
ax.set_xlabel("Full Time", size=12)
ax.set_ylabel("Median", size=12)
Out[18]:
Text(0, 0.5, 'Median')
In [68]:
recent_grads.plot.hexbin(x = "full_time", y = "median", title = "Full Time - Median", 
                         gridsize = (15), figsize = (20,10), colormap = 'seismic', sharex=False, rot = 90)
Out[68]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f9338236590>
In [19]:
ax = recent_grads.plot(x="share_women", y="unemployment_rate", kind="scatter", color="blue", figsize=(20, 7))
ax.set_title("Share Women - Unemployment Rate")
ax.set_xlabel("Share Women", size=12)
ax.set_ylabel("Unemployment Rate", size=12)
Out[19]:
Text(0, 0.5, 'Unemployment Rate')
In [70]:
ax = recent_grads.plot(x="men", y="median", kind="scatter", color="blue", figsize=(20, 7))
ax.set_title("Men - Median")
ax.set_xlabel("Men", size=12)
ax.set_ylabel("Median", size=12)
Out[70]:
Text(0, 0.5, 'Median')
In [71]:
recent_grads.plot.hexbin(x = "men", y = "median", title = "Men - Median", 
                         gridsize = (15), figsize = (20,10), colormap = 'seismic', sharex=False, rot = 90)
Out[71]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f933808b350>
In [21]:
ax = recent_grads.plot(x="women", y="median", kind="scatter", color="blue", figsize=(20, 7))
ax.set_title("Women - Median")
ax.set_xlabel("Women", size=12)
ax.set_ylabel("Median", size=12)
Out[21]:
Text(0, 0.5, 'Median')
In [73]:
recent_grads.plot.hexbin(x = "women", y = "median", title = "Women - Median", 
                         gridsize = (15), figsize = (20,10), colormap = 'seismic', sharex=False, rot = 90)
Out[73]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f9333ee9310>

From the previous plots, we can't reach a final conclusion for all the objectives but we can give an aproximate answer to the following questions:

  • Do students in more popular majors make more money?

    From the last two plots, Men - Median and Women - Median we can see that the majors with fewer students, independently if they are men or women, have a higher median earning of full time jobs.

  • Do students that majored in subjects that were majority female make more money?

    Fom the previous plots we can't give an extensed answer but as in the previous question if we compare the last two plots, Men - Median and Women - Median we can see that for Men the major agruppation in the plot is between 20.000 - 40.000 the same as for Women, then we can give a first approach to this answer that students majored in subjects were majority female don't make more money.

  • Is there any link between the number of full-time employees and median salary?

    Analyzing the Full Time - Median scatter plot, we can answer that majors that had a bigger number of full-time employees, earned the same or less than the ones with a lowe number of full-time employees.

Histograms

Secondly, using __Histograms__ to explore the distribution of the different columns.

In [22]:
recent_grads.describe()
Out[22]:
rank major_code total men women share_women 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 [23]:
ax = recent_grads['sample_size'].hist(bins=20, figsize=(20, 7))
ax.set_title("Sample Size Distribution", size=20)
ax.set_xlabel("Sample Size", size=12)
ax.set_ylabel("Value Counts", size=12)
Out[23]:
Text(0, 0.5, 'Value Counts')
In [24]:
ax = recent_grads['median'].hist(figsize=(20, 7))
ax.set_title("Median Distribution", size=20)
ax.set_xlabel("Median", size=12)
ax.set_ylabel("Value Counts", size=12)
Out[24]:
Text(0, 0.5, 'Value Counts')

From this histogram, we can answer that the median salary of full-time employers is between 30.000 and 40.000. We can use the next function to extract the exact number:

In [25]:
recent_grads['median'].median()
Out[25]:
36000.0

After checking it with the median function, we can answe that the median salary is 36.000.

In [26]:
ax = recent_grads['employed'].hist(figsize=(20, 7))
ax.set_title("Employed Distribution", size=20)
ax.set_xlabel("Employed", size=12)
ax.set_ylabel("Value Counts", size=12)
Out[26]:
Text(0, 0.5, 'Value Counts')
In [27]:
ax = recent_grads['full_time'].hist(figsize=(20, 7))
ax.set_title("Full Time Distribution", size=20)
ax.set_xlabel("Full Time", size=12)
ax.set_ylabel("Value Counts", size=12)
Out[27]:
Text(0, 0.5, 'Value Counts')
In [28]:
ax = recent_grads['share_women'].hist(figsize=(20, 7))
ax.set_title("Share Women Distribution", size=20)
ax.set_xlabel("Share Women", size=12)
ax.set_ylabel("Value Counts", size=12)
Out[28]:
Text(0, 0.5, 'Value Counts')
In [29]:
recent_grads['share_women'].value_counts(bins=10).sort_index()
Out[29]:
(-0.0019690000000000003, 0.0969]     3
(0.0969, 0.194]                     14
(0.194, 0.291]                      16
(0.291, 0.388]                      22
(0.388, 0.484]                      19
(0.484, 0.581]                      21
(0.581, 0.678]                      25
(0.678, 0.775]                      29
(0.775, 0.872]                      11
(0.872, 0.969]                      12
Name: share_women, dtype: int64

Combining the histogram with the list of intervals we can extract the following conclusion:

  • Percent of majors that are predominantly male ?

    Acording to the histogram and viewing it on the list of intervals only 3 of the total of 172 majors have a percentage between 0 and 1 feamles. In other words, 3 of the 172 majors have between 99% and 100% male students. To conclude, 1.74% of the majors are predominantly male.

  • Percent of majors that are predominantly female ?

    According to the list of intervals and viewing it on the charts 29 of the total 172 majors have a percentage between 67.8 and 77.5 female. To conclude, 16.8% of the majors are predominantly male.

In [30]:
ax = recent_grads['unemployment_rate'].hist(figsize=(20, 7))
ax.set_title("Unemployment Rate Distribution", size=20)
ax.set_xlabel("Unemployment Rate", size=12)
ax.set_ylabel("Value Counts", size=12)
Out[30]:
Text(0, 0.5, 'Value Counts')
In [31]:
ax = recent_grads['men'].hist(figsize=(20, 7))
ax.set_title("Men Graduates Distribution", size=20)
ax.set_xlabel("Men", size=12)
ax.set_ylabel("Value Counts", size=12)
Out[31]:
Text(0, 0.5, 'Value Counts')
In [32]:
ax = recent_grads['women'].hist(figsize=(20, 7))
ax.set_title("Women Graduates Distribution", size=20)
ax.set_xlabel("Women", size=12)
ax.set_ylabel("Value Counts", size=12)
Out[32]:
Text(0, 0.5, 'Value Counts')

From the histograms above, we could answer the next questions:

  • What percent of majors are predominantly male? Predominantly female?

    As is shown in the Share Women Distribution chart, 1.74% (3/172) of the majors are predominantly male and 16.8% (29/172) of the majors are predominantly male.

  • What's the most common median salary range?

    As is shown in the Median Distribution histogram the most common median salary range is between 30.000 and 40.000, exactly 36.000.

Scatter Matrix Plots

To get immediate visual information from plots we are gonna work with scatter plots matrix, to see scatter plots and histograms near.

In [33]:
scatter_matrix(recent_grads[['sample_size', 'median']], figsize=(20,10))
Out[33]:
array([[<matplotlib.axes._subplots.AxesSubplot object at 0x7f933bd1b210>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f933bd36a90>],
       [<matplotlib.axes._subplots.AxesSubplot object at 0x7f933bcedfd0>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f933bcb0410>]],
      dtype=object)
In [34]:
scatter_matrix(recent_grads[['sample_size', 'median', 'unemployment_rate']], figsize=(20,10))
Out[34]:
array([[<matplotlib.axes._subplots.AxesSubplot object at 0x7f933b77b8d0>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f933b77ca50>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f933bb78f50>],
       [<matplotlib.axes._subplots.AxesSubplot object at 0x7f933bb3a490>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f933baefa10>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f933baa4710>],
       [<matplotlib.axes._subplots.AxesSubplot object at 0x7f933c4c3a50>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f933c03aad0>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f933bfa9210>]],
      dtype=object)
In [35]:
scatter_matrix(recent_grads[['full_time', 'median']], figsize=(20,10))
Out[35]:
array([[<matplotlib.axes._subplots.AxesSubplot object at 0x7f933b8453d0>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f933b84fb10>],
       [<matplotlib.axes._subplots.AxesSubplot object at 0x7f9339f1f650>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f9339f54cd0>]],
      dtype=object)
In [36]:
scatter_matrix(recent_grads[['men', 'full_time']], figsize=(20,10))
Out[36]:
array([[<matplotlib.axes._subplots.AxesSubplot object at 0x7f9339df9310>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f9339e11610>],
       [<matplotlib.axes._subplots.AxesSubplot object at 0x7f9339dc5b50>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f9339d89210>]],
      dtype=object)
In [37]:
scatter_matrix(recent_grads[['women', 'full_time']], figsize=(20,10))
Out[37]:
array([[<matplotlib.axes._subplots.AxesSubplot object at 0x7f9339c41550>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f9339c51d50>],
       [<matplotlib.axes._subplots.AxesSubplot object at 0x7f9339c13450>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f9339bc7a90>]],
      dtype=object)

From the scatter matrixes above we could observe that the median of men that have a full-time job is directly related to the median of women.

In [38]:
scatter_matrix(recent_grads[['share_women', 'median']], figsize=(20,10))
Out[38]:
array([[<matplotlib.axes._subplots.AxesSubplot object at 0x7f9339a80250>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f9339a94410>],
       [<matplotlib.axes._subplots.AxesSubplot object at 0x7f9339a49a90>,
        <matplotlib.axes._subplots.AxesSubplot object at 0x7f9339a0c150>]],
      dtype=object)

From the above Scatter Matrix we conclude that students who majored in subjects with majority female students don't have a bigger income.

In [39]:
fig = plt.figure(figsize=(20, 10))
#fig.suptitle('First 5 & Last 5 Majors % of Women', fontsize=20)

ax1 = fig.add_subplot(1, 2, 1)
ax2 = fig.add_subplot(1, 2, 2)

recent_grads.head(10).plot(x='major', y='share_women', kind='bar', color='green', alpha=0.5, ax=ax1, legend=False)
recent_grads.tail(10).plot(x='major', y='share_women', kind='bar', color='green', alpha=0.5, ax=ax2, legend=False)
Out[39]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f933b86db10>