<jupyter_start><jupyter_text>Visualising earnings based on collage majorsThis is a DataQuest.io Guided project around pandas and matplotlib. The original data was released by [American Community Survey](https://www.census.gov/programs-surveys/acs/) and then was cleaned by FiveThirtyEight, it is available on their [Github repo](https://github.com/fivethirtyeight/data/tree/master/college-majors).Below is the data dictionary for this dataset:- Rank - Rank by median earnings (the dataset is ordered by this column).- Major_code - Major code.- Major - Major description.- Major_category - Category of major.- Total - Total number of people with major.- Sample_size - Sample size (unweighted) of full-time.- Men - Male graduates.- Women - Female graduates.- ShareWomen - Women as share of total.- Employed - Number employed.- Median - Median salary of full-time, year-round workers.- Low_wage_jobs - Number in low-wage service jobs.- Full_time - Number employed 35 hours or more.- Part_time - Number employed less than 35 hours.The questions we are going to aim to answer are:- Students that did more popular courses, do they make more money?    - For this we will use scatter graphs- How many majors are mostly male and how many mostly female?    - Using Histograms- Which category of Major has the most students?    - This will be shown in bar plots.  Setting up up the enviromentWe are going to import all the required libraries and running the Jupyter `magic` inline so the plots will be displayed inside the notebook. Then import the dataset as a DataFrame. Once it is is imported we will do some basic exploration of the data inside it.<jupyter_code>import matplotlib
import pandas as pd

%matplotlib inline
recent_grads = pd.read_csv('recent-grads.csv')

print(recent_grads.iloc[0])
print('-' * 75)
print(recent_grads.head())
print('-' * 75)
print(recent_grads.tail())
print('-' * 75)
print(recent_grads.describe())
print('-' * 75)
print(recent_grads.isnull().sum())<jupyter_output>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
-----------[...]<jupyter_text>I need to drop the rows containing missing values due to the fact that Matplotlib will throw errors.<jupyter_code>recent_grads = recent_grads.dropna()
print(recent_grads.isnull().sum())<jupyter_output>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<jupyter_text>Exploritory graphs- Sample_size and Median- Sample_size and Unemployment_rate- Full_time and Median- ShareWomen and Unemployment_rate- Men and Median- Women and Median<jupyter_code>ax = recent_grads.plot(x='Sample_size', y='Median', kind='scatter')
ax.set_title('Sample_size vs. Median')
ax = recent_grads.plot(x='Sample_size', y='Unemployment_rate', kind='scatter')
ax.set_title('Sample_size vs. Unemployment_rate')
ax = recent_grads.plot(x='Full_time', y='Median', kind='scatter')
ax.set_title('Full_time vs. Median')
ax = recent_grads.plot(x='ShareWomen', y='Unemployment_rate', kind='scatter')
ax.set_title('ShareWomen vs. Unemployment_rate')
ax = recent_grads.plot(x='Men', y='Median', kind='scatter')
ax.set_title('Men vs. Median')
ax = recent_grads.plot(x='Women', y='Median', kind='scatter')
ax.set_title('Women vs. Median')
recent_grads['Sample_size'].hist(bins=25, range=(0,5000))
recent_grads['Median'].hist(bins=16, range=(22000,110000))
recent_grads['Employed'].hist(bins=20, range=(0,310000))
recent_grads['Full_time'].hist(bins=20, range=(111,252000))
recent_grads['ShareWomen'].hist(bins=25, range=(0,1))
recent_grads['Unemployment_rate'].hist(bins=20, range=(0,0.2))
recent_grads['Men'].hist(bins=50, range=(119,173809))
recent_grads['Women'].hist(bins=50, range=(0, 307087))
from pandas.plotting import scatter_matrix

scatter_matrix(recent_grads[['Sample_size', 'Median']], figsize = (10, 10))
scatter_matrix(recent_grads[['Sample_size', 'Median', 'Unemployment_rate']], figsize = (10, 10))
recent_grads[:5]['Women'].plot(kind='bar')
recent_grads[:5].plot.bar(x='Major', y='Women')
recent_grads.head(10).plot.bar(x = 'Major', y = 'ShareWomen')
recent_grads.tail(10).plot.bar(x = 'Major', y = 'ShareWomen')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.0986628117094326, 'fraction_numerical': 0.03704372967112396, 'mean_word_length': 2.5412667946257197, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 9, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '168698', 'license': 'MIT', 'n_tokens_mistral': 1791, 'n_tokens_neox': 1550, 'n_words': 461, 'path': 'visualise.ipynb', 'repo_name': 'garethhay/visualising_earning_on_majors', 'size': '5534'}