112 KiB
112 KiB
In [48]:
import pandas as pd
df = pd.read_csv("../data/healthcare-dataset-stroke-data.csv", index_col="id")
data = df.copy()
hypertension_df = data[data["hypertension"] == 1]
heart_disease_df = data[data["heart_disease"] == 1]
hypertension_df.groupby(["gender"]).size().plot(kind='pie', y='gender', autopct='%1.0f%%')
Out[48]:
In [49]:
heart_disease_df.groupby(["gender"]).size().plot(kind='pie', y='gender', autopct='%1.0f%%')
Out[49]:
In [50]:
hypertension_df.plot.hist(column=["age"], bins=80)
Out[50]:
In [51]:
heart_disease_df.plot.hist(column=["age"], bins=80)
Out[51]:
In [52]:
heart_disease_df.groupby(["work_type"]).size().plot(kind='pie', y='work_type', autopct='%1.2f%%')
Out[52]:
In [53]:
hypertension_df.groupby(["work_type"]).size().plot(kind='pie', y='work_type', autopct='%1.2f%%')
Out[53]:
In [53]: