<jupyter_start><jupyter_text>SQL - Bonus---- Note* Import the SQL database into Pandas. (Yes, you could read the CSVs directly in Pandas, but you are, after all, trying to prove your technical mettle.) This step may require some research. Feel free to use the code below to get started. Be sure to make any necessary modifications for your username, password, host, port, and database name:<jupyter_code>import matplotlib.pyplot as plt
from matplotlib.pyplot import figure

import pandas as pd
import numpy as np

from sqlalchemy import create_engine

# Import Password
from password import SQL_pw

engine = create_engine('postgres://postgres:'+ (SQL_pw) +'@localhost:5432/Employees')
connection = engine.connect()
salaryData_df = pd.read_sql('SELECT salaries.emp_no, salaries.salary, titles.title FROM salaries INNER JOIN titles on salaries.emp_no = titles.emp_no ', connection)
salaryData_df.head()<jupyter_output><empty_output><jupyter_text>Create a histogram to visualize the most common salary ranges for employees<jupyter_code>salaries = salaryData_df['salary']
figure(num=None, figsize=(8, 6), dpi=80, facecolor='w', edgecolor='k')
plt.title("Salary Range for Employees", fontsize='large', fontweight='bold')
plt.hist(salaries)
plt.xlabel('Salaries', fontsize='large', fontweight='bold')
plt.ylabel('Number of Employees', fontsize='large', fontweight='bold')
plt.show()
avgSalary_df = salaryData_df.groupby('title').mean()
avgSalary_df.head()<jupyter_output><empty_output><jupyter_text>Create a bar chart of average salary by title<jupyter_code>avgSalary = avgSalary_df.reset_index()
figure(num=None, figsize=(8, 6), dpi=80, facecolor='w', edgecolor='k')
xTitle = avgSalary['title']
ySalary = avgSalary['salary']
plt.bar(xTitle, ySalary, align='center', color=['deepskyblue','darkorchid','lightcoral','darkorange','green','indianred','blue'])
plt.xticks(xTitle, rotation='vertical')
plt.title('Average Salary by Title', fontsize='large', fontweight='bold')
plt.xlabel('Job Title', fontsize='large', fontweight='bold')
plt.ylabel('Avg Salary ($)', fontsize='large', fontweight='bold')
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1342092914124824, 'fraction_numerical': 0.005631159080244017, 'mean_word_length': 7.957983193277311, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '361391', 'license': 'ADSL', 'n_tokens_mistral': 709, 'n_tokens_neox': 674, 'n_words': 184, 'path': 'bonus.ipynb', 'repo_name': 'kswalkup/sql-challenge', 'size': '2131'}