<jupyter_start><jupyter_text>engine = create_engine(f"postgresql://127.0.0.1:49818/Employees_db")connection = engine.connect() The kernel stopped working whenever I tried to run the above code.  Therefore, to complete the optional part of the assignment I used the CSV files.<jupyter_code>salaries_data = "data/salaries.csv"
titles_data = "data/titles.csv"

salaries_df = pd.read_csv(salaries_data)
salaries_df
titles_df = pd.read_csv(titles_data)
titles_df
merged_tables = pd.merge(salaries_df, titles_df, on = "emp_no", how = "inner")
merged_tables
grouped_titles = merged_tables.groupby("title").mean()
grouped_titles
titles_salaries_df = grouped_titles.drop(columns = "emp_no")
titles_salaries_df = titles_salaries_df.reset_index()
titles_salaries_df
x_axis = titles_salaries_df["title"]
ticks = np.arange(len(x_axis))
y_axis = titles_salaries_df["salary"]
plt.bar(x_axis, y_axis, align="center", alpha=1.0, color=["b", "r", "orange", "g", "y", "gray", "r"])

plt.xticks(ticks, x_axis, rotation="vertical")

plt.ylabel("Salaries ($)")
plt.xlabel("Titles")
plt.title("Average Salary by Title")

plt.savefig("data/Average_salary_by_title.png")

plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14153327716933445, 'fraction_numerical': 0.010951979780960405, 'mean_word_length': 7.671532846715328, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '379699', 'license': 'ADSL', 'n_tokens_mistral': 467, 'n_tokens_neox': 446, 'n_words': 83, 'path': 'bonus_analysis.ipynb', 'repo_name': 'Shahidmumtaz/sql_challenge', 'size': '1187'}