text_html_output_1.png
import matplotlib.pyplot as plt

import pandas as pd

import seaborn as sns

import numpy as np
import pandas as pd
pd.set_option('display.max_columns', 50)
import os
from scipy import stats
import matplotlib.pyplot as plt
import seaborn as sns

TRAIN_PATH = '/kaggle/input/hr-analytics-job-change-of-data-scientists/aug_train.csv'
TEST_PATH = '/kaggle/input/hr-analytics-job-change-of-data-scientists/aug_test.csv'

df = pd.read_csv(TRAIN_PATH)

print(f"Dataset has {len(df['city'].dropna().unique())} unique cities.")
print("_"*20)
print(f"Unique cities count:\n{df['city'].value_counts()}")
print("*"*50, end="\n\n")

fig, ax = plt.subplots(figsize=(12, 6))
sns.barplot(ax=ax, x=df['city'].value_counts().index[:10], y=df['city'].value_counts().values[:10], capsize=.2,palette="Blues_d")

ax.set_title("Unique city count bar chart",fontsize=16)
ax.set_xlabel("City",fontsize=14)
ax.set_ylabel("Count",fontsize=14)

plt.show()

city_with_dev = df.groupby(['city']).mean()['city_development_index'].reset_index()
city_with_dev = city_with_dev.sort_values(by=['city_development_index'], ascending=False).reset_index(drop=True)

fig, ax = plt.subplots(figsize=(16, 6))
sns.barplot(ax=ax, x=city_with_dev['city'][:15], y=city_with_dev['city_development_index'][:15], palette='Blues_d')
ax.set_title('Top 15 cities with best development index bar chart', fontsize=16)
ax.set_xlabel('City', fontsize=14)
ax.set_ylabel('Development Index', fontsize=14)
plt.show()