Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # The data is as follows:
- # 1. age (age in years)
- # 2. sex (1:Male, 0:Female)
- # 3. chest pain type (4 values) aka cp
- # 4. resting blood pressure (in mm Hg on admission to the hospital) aka trestbps
- # 5. serum cholesterol (in mg/dl) aka chol
- # 6. fasting blood sugar > 120 mg/dl aka fbs
- # 7. resting electrocardiographic results (values 0,1,2)
- # 8. maximum heart rate achieved
- # 9. exercise induced angina
- # 10. old peak = ST depression induced by exercise relative to rest
- # 11. the slope of the peak exercise ST segment
- # 12. number of major vessels (0-3) colored by fluoroscopy
- # 13. thal: 3 = normal; 6 = fixed defect; 7 = reversable defect
- # 14. target
- #_______________________________________________________________________________
- heart['cp'].value_counts()
- # The result of the above line:
- # 0 143
- # 2 87
- # 1 50
- # 3 23
- # Name: cp, dtype: int64
- labels = ["Type 0","Type 1","Type 2","Type 3"]
- cp_types = heart['cp'].value_counts().values
- plt.pie(cp_types,autopct="%.1f%%", labels = labels)
- plt.title("Chest Pain Types")
- plt.show()
- #As we can notice from the data chest pain type zero is the most common in our data
- #_______________________________________________________________________________
- sns.countplot(x='sex',hue='target',data=heart)
- # As we can see in the plot the number of males who had heart disease is much greater than the number of females
- #_______________________________________________________________________________
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement