text_html_output_1.png
import matplotlib.pyplot as plt

import pandas as pd

data = pd.read_csv('../input/kaggle-survey-2020/kaggle_survey_2020_responses.csv')

data.shape

question = data.iloc[0, :]
data = data.iloc[1:, :]

fig,ax=plt.subplots(1,1,figsize=(8,5),dpi=200)

dataQ1=data['Q1'].value_counts().sort_index()

ax.bar(dataQ1.index,dataQ1)
plt.show()

dataQ2=data['Q2'].apply(lambda x:'x' if x not in ['Man','Woman'] else x)

fig,ax=plt.subplots(1,1,figsize=(8,5),dpi=200)

dataQ2=dataQ2.loc[dataQ2!='x'].value_counts()

ax.bar(dataQ2.index,dataQ2)
plt.show()

data['Q2']=data['Q2'].apply(lambda x:'x' if x not in ['Man','Woman'] else x)
gender=data[data['Q2']!='x'].groupby('Q2')['Q1'].value_counts().unstack()

man=gender.loc['Man']
woman=gender.loc['Woman']

fig,ax=plt.subplots(1,1,figsize=(8,6),dpi=200)

ax.bar(man.index,man)
ax.bar(woman.index,woman)

plt.show()

dataQ3=data['Q3'].value_counts()[:10]
fig,ax=plt.subplots(1,1,figsize=(8,6),dpi=200)

ax.barh(dataQ3.index,dataQ3)

plt.show()

dataQ4 = data['Q4'].value_counts()[:10]
fig, ax = plt.subplots(1, 1, figsize=(8, 6), dpi=200)
ax.barh(dataQ4.index, dataQ4)
plt.show()