<jupyter_start><jupyter_text>2. Create a histogram to visualize the most common salary ranges for employees.<jupyter_code>emp = pd.read_sql('SELECT * FROM employees', connection)
sal = pd.read_sql('SELECT * FROM salaries', connection)
emp.head(1)
sal.head(1)
emp_sal = emp.merge(sal, on='emp_no')
titles = pd.read_sql('SELECT * FROM titles', connection)
emp_sal_title = emp_sal.merge(titles, on='emp_no')
avg_sal = emp_sal_title[['emp_no','title','salary']]
avg_sal.head()
avg_sal.hist('salary')
avg_sal.groupby('title')\
[['salary']].mean().round(2).sort_values('salary', ascending=False)
avg_sal.drop(columns='emp_no').groupby('title').mean().sort_values('salary', ascending=False).plot(kind='bar')
emp.loc[emp.emp_no == 499942]<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18026315789473685, 'fraction_numerical': 0.013157894736842105, 'mean_word_length': 8.632911392405063, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '69047', 'license': 'ADSL', 'n_tokens_mistral': 285, 'n_tokens_neox': 274, 'n_words': 46, 'path': 'bonus.ipynb', 'repo_name': 'Megaexoplanet/SQL-Challenge', 'size': '760'}