**About Dataset :** Based on the 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.

**Data Dictionary :** Each row in the dataset represents a different major in college and contains information on gender diversity, employment rates, median salaries, and more. Here are some of the columns in the 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.

**Aim :** Using different plots for visualizations, we will explore questions from the dataset like:

- Do students in more popular majors make more money? -Using scatter plots
- How many majors are predominantly male? Predominantly female? -Using histograms
- Which category of majors have the most students? -Using bar plots
- Other interesting Questions

**Library used : Matplotlib**

**Types of Plot used -**

**Scatterplots, Histograms, Multipleplots, Scatter Matrix Plots, Bar Plots, Box Plots,Hexagonal bin plots**

Let's import the libraries we need and remove rows containing null values.

In [1]:

```
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
```

In [2]:

```
# Path of file
grads_file_path = (r'C:\Users\anuja\Downloads\recent-grads_csv.csv')
recent_grads = pd.read_csv(grads_file_path, encoding='Latin-1')
```

In [3]:

```
# to return the first row formatted as a table.
recent_grads.iloc[0]
```

Out[3]:

In [4]:

```
recent_grads.head(2)
```

Out[4]:

In [5]:

```
recent_grads.tail(2)
```

Out[5]:

In [6]:

```
recent_grads.describe()
```

Out[6]:

In [7]:

```
# number of rows
raw_data_count = len(recent_grads)
print(raw_data_count)
```

In [8]:

```
# to drop rows containing missing values
recent_grads = recent_grads.dropna()
```

In [9]:

```
cleaned_data_count = len(recent_grads)
print(cleaned_data_count)
```

One row contained missing values.

- Sample_size and Median
- Sample_size and Unemployment_rate
- Full_time and Median
- ShareWomen and Unemployment_rate
- Men and Median
- Women and Median

In [10]:

```
recent_grads.plot(x='Sample_size', y='Employed', kind='scatter').set_title('Employed vs. Sample_size')
```

Out[10]:

- The scatter plot suggests that there's a strong, positive correlation between the sample size (full time) and the Employed students.
- The correlation is strong because so many points for both variables are closed to each other.
- The correlation is positive because, in general, as x increases, y also increases.

In [11]:

```
recent_grads.plot(x='Sample_size', y='Unemployment_rate', kind='scatter').set_title('Sample_size vs. Unemployment_rate')
```

Out[11]:

- The scatter plot suggests that there's no correlation between the Sample_size and Unemployment_rate.
- The vertical line means that the input and output values are irrelevant to each other.

In [12]:

```
recent_grads.plot(x='Full_time', y='Median', kind='scatter').set_title('Full_time vs. Median')
```

Out[12]:

- The scatter plot suggests that there's no correlation between the Full_time and Median.
- The vertical line means that the input and output values are irrelevant to each other.

In [13]:

```
recent_grads.plot(x='ShareWomen', y='Unemployment_rate', kind='scatter').set_title('ShareWomen vs. Unemployment_rate')
```

Out[13]:

- The scatter plot suggests that there's no correlation between theShareWomen and Unemployment_rate.

In [14]:

```
recent_grads.plot(x='Men', y='Median', kind='scatter').set_title('Men vs. Median')
```

Out[14]:

- The scatter plot suggests that there's no correlation between the Men and Median.
- The vertical line means that the input and output values are irrelevant to each other.

In [15]:

```
recent_grads.plot(x='Women', y='Employed', kind='scatter').set_title('Women vs. Median')
```

Out[15]:

- The scatter plot suggests that there's a positive correlation between the Women and the Median.
- The correlation is near to strong because so many points for both variables are closed to each other.
- The correlation is positive because, in general, as x increases, y also increases.

- Do students in more popular majors make more money?
- Do students that majored in subjects that were majority female make more money?
- Is there any link between the number of full-time employees and median salary?

In [17]:

```
recent_grads['Major_category'].unique()
```

Out[17]:

In [18]:

```
category = ['Engineering', 'Business', 'Physical Sciences',
'Law & Public Policy', 'Computers & Mathematics',
'Industrial Arts & Consumer Services', 'Arts', 'Health',
'Social Science', 'Biology & Life Science', 'Education',
'Agriculture & Natural Resources', 'Humanities & Liberal Arts',
'Psychology & Social Work', 'Communications & Journalism',
'Interdisciplinary']
ax7 = recent_grads.plot(x='Major_category', y='Median', kind='scatter')
ax7.set_title('Major_Category vs. Median')
ax7.set_xticklabels(category,rotation=90)
```

Out[18]:

**Question-Do students in more popular majors make more money?**

**Answer -**

- In Engineering Major_category, more Median Salary is observed.
- There is no correlation between Sample_size and Unemployment_rate

**Question - Do students that majored in subjects that were majority female make more money?**

**Answer -** There is no correlation between Major_category and median salary

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

**Answer-**

- The scatter plot suggests that there is ver weak correlation between the Full_time and Median.
- The vertical line means that the input and output values are irrelevant to each other.

**Generate histograms in separate jupyter notebook cells to explore the distributions of the following columns:**

- Sample_size
- Median
- Employed
- Full_time
- ShareWomen
- Unemployment_rate
- Men
- Women

In [19]:

```
recent_grads['Sample_size'].plot(kind='hist').set_title('Values distribution of Sample_size')
```

Out[19]:

As per observation from generated histogram, More than 50% values for Sample_sixe category falls under 500.

In [20]:

```
recent_grads['Median'].plot(kind='hist').set_title('Values distribution of Median')
```

Out[20]:

As per observation from generated histogram, Around 50% median salary values fall in between 22000 to 42000.

In [21]:

```
recent_grads['Employed'].plot(kind='hist').set_title('Values distribution of Employed')
```

Out[21]:

As per observation from generated histogram, More than 50% values for employed category fall in between 0 to 50000 range.

In [22]:

```
recent_grads['Full_time'].plot(kind='hist').set_title('Values distribution of Full_time')
```

Out[22]:

As per observation from generated histogram, More than 50% values for full_time category fall in between 0 to 50000 range.

In [23]:

```
recent_grads['ShareWomen'].plot(kind='hist').set_title('Values distribution of ShareWomen')
```

Out[23]:

As per observation from generated histogram, ShareWomen values within range of 0.2 - 0.6 have atleast freaquency of 15%.

In [24]:

```
recent_grads['Unemployment_rate'].plot(kind='hist').set_title('Values distribution of Unemployment_rate')
```

Out[24]:

As per observation from generated histogram, For Unemployment_rate category all values have atleast freaquency of 10%.

In [25]:

```
recent_grads['Men'].plot(kind='hist').set_title('Values distribution of Men')
```

Out[25]:

or for more ease in readibilty, we can customize the bins of histogram, shown below-

In [26]:

```
recent_grads['Men'].hist(bins=5).set_title('Values distribution of Men')
```

Out[26]:

As per observation from generated histogram, 20% values for Men category fall in range of 0 - 25000.

In [27]:

```
recent_grads['Women'].hist(bins=5).set_title('Values distribution of Women')
```

Out[27]:

As per observation from generated histogram histogram, 20% values for Women category fall in range of 0 - 50000.

**Aim : To answer - Which Majors are predominantly male? Predominantly female?**

In [28]:

```
# Comparing Men and Women against different Majors using Line Chart
# Aim : To answer - Which majors are predominantly male? Predominantly female?
# fig = plt.figure(figsize=(20,38))
fig = plt.figure(figsize=(20,100))
colors = ['red','blue' ]
plt.plot(recent_grads['Men'], recent_grads['Major'], c='red', label='Men')
plt.plot(recent_grads['Women'],recent_grads['Major'], c='blue', label='Women')
plt.legend(loc='upper left')
plt.ylabel('Majors')
plt.show()
```

Women are having high percentage of participation over Males in Majors.

- What percent of majors are predominantly male? Predominantly female?
- What's the most common median salary range?

**Answers -**

- 20% values for Women category fall in range of 0 - 50000 and 20% values for Men category fall in range of 0 - 25000.
Females are predominant over male almost in all Majors.

Most Common Median Salary is22000 to 42000, which accounts to 50 % of Median Salary Values.

Earlier we have created individual scatter plots to visualize potential relationships between columns and histograms to visualize the distributions of individual columns.

A **Scatter Matrix Plot** combines both scatter plots and histograms into one grid of plots and allows us to explore potential relationships and distributions simultaneously. A scatter matrix plot consists of n by n plots on a grid, where n is the number of columns, the plots on the diagonal are histograms, and the non-diagonal plots are scatter plots.

In [29]:

```
from pandas.plotting import scatter_matrix
```

In [30]:

```
# To Create a 2 by 2 scatter matrix plot using the Sample_size and Median columns.
scatter_matrix(recent_grads[['Sample_size', 'Median']], figsize=(10,10))
```

Out[30]:

- From Histogram - 50% of Median Salary Value falls in range of 22000 to 42000 and More than 50% values for Sample_sixe category falls under 500.
- From Scatterplot -Sample_size and Median are not correlated
- With the help of Scatter_Matrix plot, we performed two plots together.

In [31]:

```
# To Create a 3 by 3 scatter matrix plot using the Sample_size, Median, and Unemployment_rate columns.
scatter_matrix(recent_grads[['Sample_size', 'Median', 'Unemployment_rate']], figsize=(10,10))
```

Out[31]: