<jupyter_start><jupyter_text>Dependencies___<jupyter_code>import pandas as pd

from matplotlib import pyplot as plt

%matplotlib inline

from Password import password 

from sqlalchemy import create_engine

engine = create_engine(f'postgresql://postgres:{password}@localhost:5432/Pewlett Hackard Employees')

connection = engine.connect()<jupyter_output><empty_output><jupyter_text>Import the employees table___<jupyter_code>employees = pd.read_sql('select * from employees', connection)
employees<jupyter_output><empty_output><jupyter_text>Import the salaries table___<jupyter_code>salaries = pd.read_sql('select * from salaries', connection)
salaries<jupyter_output><empty_output><jupyter_text>Import the titles table___<jupyter_code>titles = pd.read_sql('select * from titles', connection)
titles
titles.title.value_counts()<jupyter_output><empty_output><jupyter_text>Create a histogram to visualize the most common salary ranges for employees.___<jupyter_code>salaries[["salary"]].plot(kind = 'hist',
                          figsize = (9,6),
                          color = 'cyan',
                          edgecolor = 'm',
                          xticks = [40000,50000,60000,70000,80000,90000,100000,110000,120000],
                          fontsize = 13
                         )

# Incorporate the other graph properties

plt.title("Salary range", color = "m", fontsize = 20, pad = 10)

plt.xlabel("Salary", color = "m", fontsize = 16)

plt.ylabel("Employee Count", color = "m", fontsize = 16)

plt.tight_layout()

plt.show()<jupyter_output><empty_output><jupyter_text>_The most common salary range is between 40,000  and 49,000 dollars____   Create a dataframe by merging salaries and titles tables___<jupyter_code>avg_salary_title = pd.merge(salaries,titles, on = "emp_no")
avg_salary_title = avg_salary_title[['salary','title']]
avg_salary_title<jupyter_output><empty_output><jupyter_text>Use groupby to find average salary by title<jupyter_code>avg_salary_title = avg_salary_title.groupby('title')["salary"].mean()
avg_salary_title = round(avg_salary_title,2)
avg_salary_title<jupyter_output><empty_output><jupyter_text>Plot a bar chart to visualize Average Salary by Title___<jupyter_code>avg_salary_title.plot(kind = 'bar',
                      figsize = (8,7),
                      color = 'm',
                      edgecolor = 'cyan',
                      fontsize = 13
                     )

# Incorporate the other graph properties
plt.title("Average Salary by Title", color = "m", fontsize = 20, pad = 10)

plt.xlabel("Title", color = "m", fontsize = 16)

plt.ylabel("Salary", color = "m", fontsize = 16)

plt.tight_layout()

plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10971089696071164, 'fraction_numerical': 0.03224610822831727, 'mean_word_length': 4.073308270676692, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, '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': '8', 'dir': 'jupyter-structured-clean-dedup', 'id': '87308', 'license': 'ADSL', 'n_tokens_mistral': 972, 'n_tokens_neox': 871, 'n_words': 180, 'path': '.ipynb_checkpoints/Sql_HW_Bonus-checkpoint.ipynb', 'repo_name': 'Latha-G/SQL-Challenge', 'size': '2698'}