image_output_1.png
import matplotlib.pyplot as plt

import pandas as pd

import warnings

import numpy as np
import pandas as pd
import warnings
warnings.filterwarnings('ignore')
import plotly.express as px
import matplotlib.pyplot as plt
import seaborn as sns
import os
kaggle_survey_2019 = pd.read_csv('../input/kaggle-survey-2019/multiple_choice_responses.csv')
kaggle_survey_2020 = pd.read_csv('../input/kaggle-survey-2020/kaggle_survey_2020_responses.csv')
kaggle_survey_2021 = pd.read_csv('../input/kaggle-survey-2021/kaggle_survey_2021_responses.csv')
indo_survey_2019 = kaggle_survey_2019[kaggle_survey_2019['Q3'] == 'Indonesia']
indo_survey_2020 = kaggle_survey_2020[kaggle_survey_2020['Q3'] == 'Indonesia']
indo_survey_2021 = kaggle_survey_2021[kaggle_survey_2021['Q3'] == 'Indonesia']

# kaggle_survey_2019 = kaggle_survey_2019[kaggle_survey_2019['Q3']=='Indonesia'].drop\
# (kaggle_survey_2019.columns[0], axis=1)
# kaggle_survey_2019.head()
# question = pd.read_csv('../input/kaggle-survey-2019/questions_only.csv')
# question.columns
# question_list = question.loc[0].tolist()
# question_list
f, ax = plt.subplots(nrows=1, ncols=3, figsize=(15,4))
barcolors = ['darkseagreen', 'peru', 'navy']

barstyle = {"edgecolor":"black", "linewidth":0.5}

indo_survey_2019['Q2'].value_counts().plot.bar(ax=ax[0], color=barcolors[0])
ax[0].set_title("2019")
indo_survey_2020['Q2'].value_counts().plot.bar(ax=ax[1], color=barcolors[1])
ax[1].set_title("2020")
indo_survey_2021['Q2'].value_counts().plot.bar(ax=ax[2], color=barcolors[2])
ax[2].set_title("2021")
plt.show()
    

def roleDanSize(df):
    newdf = df.groupby(['Q4', 'Q5']).size()
    newdf = newdf.to_frame(name='size').reset_index()
    newdf['role'] = newdf['Q4'] + '-' + newdf['Q5']
    newdf = newdf.drop(columns=['Q4', 'Q5']).sort_values(by=['size'])
    return newdf
data_2019 = roleDanSize(indo_survey_2019)
plt.figure(figsize=(10, 15))
plt.barh(data_2019['role'], data_2019['size'])
plt.title('Banyak kemunculan relasi antara pendidikan terakhir dan pekerjaan 2019')
plt.ylabel('Pendidikan-Pekerjaan')
plt.xlabel('Jumlah')
plt.show()