<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 White House Employee Data
The 2015_white_house.csv* file contains data on White House employees in 2015, and their salares.  Here are the columns
Step1:  So far we have imported a dataset from a CSV file into a Pandas DataFrame using the read_csv() function.  Then we displayed the data, first as a table, and secondly as a historgram.
Questions About the Data
There are a near infinite number of questions we could possibly ask about this data.  But to get started, here are a few example questions that could be asked
Step2:  Uh ok, maybe I was wrong about visuallizing being great for detecting correlation ;-)
It looks like there may be a weak positive correlation.  But it is really hard to tell.
Maybe we should just numerically calculate the correlation. 
Also, it looks like there are some low salary outliers.  Should we check to make sure we aren't mixing in monthly salaries with yearly ones?
Step3:  Ok, only one pay basis, annually.  So that wasn't an issue.
Step4:  So yea, there is a real positive correlation between length of employee title and salary!
How much does the White House pay in total salary?
Step5:  The white house pays about $40 Million per year in total salary.
Who are the highest and lowest paid staffers?
<ASSISTANT_TASK:>
Python Code:
import pandas as pd
white_house = pd.read_csv("../data/2015_white_house.csv")
print(white_house.shape)
print(white_house.iloc[-1])
white_house
%matplotlib notebook
import matplotlib.pyplot as plt
plt.hist(white_house["Salary"])
plt.show()
Explanation: White House Employee Data
The 2015_white_house.csv* file contains data on White House employees in 2015, and their salares.  Here are the columns:
Name -- the name of the employee.
Status -- whether the employee was a White hHuse employee, or detailed to the White House.
Salary -- the employee salary, in USD.
Pay Basis -- the time period the salary is expressed over.
Position Title -- the title of the employee.
End of explanation
# Calculate the length of each employee's title and add to the DataFrame
white_house['LengthOfTitle'] = white_house['Position Title'].apply(len)
white_house.head()
# Plot the length of employee title versus salary to look for correlation
plt.plot(white_house['LengthOfTitle'], white_house['Salary'])
plt.title('How does length of employee titles correlate to salary?')
plt.xlabel('Length of Employee Title')
plt.ylabel('Salary ($)')
Explanation: So far we have imported a dataset from a CSV file into a Pandas DataFrame using the read_csv() function.  Then we displayed the data, first as a table, and secondly as a historgram.
Questions About the Data
There are a near infinite number of questions we could possibly ask about this data.  But to get started, here are a few example questions that could be asked:
How does length of employee titles correlate to salary?
How much does the White House pay in total salary?
Who are the highest and lowest paid staffers?
What words are the most common in titles?
How does the length of employee titles correlate to salary?
Steps for figuring this out may look like the following:
1. Calculate the length of each employee title - should be able to use apply() to get this
1. Add a column to the DataFrame containing the length of the employee title
1. Plot length of employee title versus employee salary (could also use direct correlation, but visual plot is good)
End of explanation
# Get the values in Pay Basis and figure out how many unique ones there are
types_of_pay_basis = set(white_house['Pay Basis'])
types_of_pay_basis
Explanation: Uh ok, maybe I was wrong about visuallizing being great for detecting correlation ;-)
It looks like there may be a weak positive correlation.  But it is really hard to tell.
Maybe we should just numerically calculate the correlation. 
Also, it looks like there are some low salary outliers.  Should we check to make sure we aren't mixing in monthly salaries with yearly ones?
End of explanation
# Compute pairwise correlation of columns, excluding NA/null values
correlations = white_house.corr()
correlations
# Linear Regression using ordinary least squares
import statsmodels.api as sm
model = sm.OLS(white_house['Salary'], white_house['LengthOfTitle'])
residuals = model.fit()
print(residuals.summary())
Explanation: Ok, only one pay basis, annually.  So that wasn't an issue.
End of explanation
total_salary = sum(white_house['Salary'])
total_salary
Explanation: So yea, there is a real positive correlation between length of employee title and salary!
How much does the White House pay in total salary?
End of explanation
highest_paid = white_house[white_house['Salary'] == max(white_house['Salary'])]
highest_paid
lowest_paid = white_house[white_house['Salary'] == min(white_house['Salary'])]
lowest_paid
Explanation: The white house pays about $40 Million per year in total salary.
Who are the highest and lowest paid staffers?
End of explanation
<END_TASK>