# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: 'Python 3.8.10 64-bit (''hra'': conda)'
#     name: python3
# ---

import pandas as pd
import json

df = pd.read_csv('./../../data/raw_data.csv')

df.head()

df.info()

# +
education = {
    1: 'Below College',
    2: 'College',
    3: 'Bachelor',
    4: 'Master',
    5: 'Doctor'
}

environment_satisfaction = {
1: 'Low',
2: 'Medium',
3: 'High',
4: 'Very High',
}

job_involvement={
1: 'Low',
2: 'Medium',
3: 'High',
4: 'Very High'
}

job_satisfaction = {
1: 'Low',
2: 'Medium',
3: 'High',
4: 'Very High',
}

performance_rating = {
1: 'Low',
2: 'Good',
3: 'Excellent',
4: 'Outstanding'
}

relationship_satisfaction = {
1: 'Low',
2: 'Medium',
3: 'High',
4: 'Very High'
}

work_life_balance = {
1: 'Bad',
2: 'Good',
3: 'Better',
4: 'Best'
}

job_level = {
    1: 'level_1',
    2: 'level_2',
    3: 'level_3',
    4: 'level_4',
    5: 'level_5'
}

stock_option_level = {
    0: 'level_0',
    1: 'level_1',
    2: 'level_2',
    3: 'level_3'
}


# -

df['Education'] = df['Education'].replace(education)

df['EnvironmentSatisfaction'] = df['EnvironmentSatisfaction'].replace(environment_satisfaction)

df['JobInvolvement'] = df['JobInvolvement'].replace(job_involvement)

df['JobSatisfaction'] = df['JobSatisfaction'].replace(job_satisfaction)

df['PerformanceRating'] = df['PerformanceRating'].replace(performance_rating)

df['RelationshipSatisfaction'] = df['RelationshipSatisfaction'].replace(relationship_satisfaction)

df['WorkLifeBalance'] = df['WorkLifeBalance'].replace(work_life_balance)

df['JobLevel'] = df['JobLevel'].replace(job_level)

df['StockOptionLevel'] = df['StockOptionLevel'].replace(stock_option_level)

df.info()

cat_df = df.select_dtypes(include='object')

cat_df.info()

num_df = df.select_dtypes(exclude='object')

num_df.info()

static_dict = {
    'categorical_columns': list(cat_df.columns),
    'numerical_columns': list(num_df.columns)
}

with open('./../../data/statics.json', 'w') as f:
    json.dump(static_dict, f)

df.to_csv('./../../data/data.csv', index=False)

StarcoderdataJupyterScriptsDedupFiltered