text_plain_output_1.png image_output_2.png image_output_1.png
from collections import Counter

from sklearn.preprocessing import MinMaxScaler

import pandas as pd

import pandas as pd

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

import plotly.graph_objects as go

all_data = pd.read_csv('/kaggle/input/data-science-salaries-2023/ds_salaries.csv')

all_data = all_data.drop('salary', axis=1)
all_data = all_data.drop('salary_currency', axis=1)
all_data = all_data.drop('employee_residence', axis=1)

all_data.nunique()

all_data = all_data.drop('salary_in_usd', axis=1)

df_reg = pd.get_dummies(all_data, drop_first=True, columns=['experience_level', 'employment_type', 'company_size', 'job_title', 'company_location'])
df_reg

aux = df_reg
scaler = MinMaxScaler()
aux = pd.DataFrame(scaler.fit_transform(aux), columns=aux.columns)

df_clas = pd.get_dummies(all_data, drop_first=True, columns=['experience_level', 'employment_type', 'company_size', 'company_location'])
df_clas

from collections import Counter
import plotly.graph_objects as go
def plot_class_distribution(df, class_col):
    categories = sorted(df[class_col].unique(), reverse=False)
    hist = Counter(df[class_col])
    fig = go.Figure(layout=go.Layout(height=400, width=600))
    fig.add_trace(go.Bar(x=categories, y=[hist[cat] for cat in categories]))

plot_class_distribution(df_clas, 'job_title')