Shatha893

Untitled

May 16th, 2021
513
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # The data is as follows:
  2.  
  3. # 1.    age (age in years)
  4. # 2.    sex (1:Male, 0:Female)
  5. # 3.    chest pain type (4 values) aka cp
  6. # 4.    resting blood pressure (in mm Hg on admission to the hospital) aka trestbps
  7. # 5.    serum cholesterol (in mg/dl) aka chol
  8. # 6.    fasting blood sugar > 120 mg/dl aka fbs
  9. # 7.    resting electrocardiographic results (values 0,1,2)
  10. # 8.    maximum heart rate achieved
  11. # 9.    exercise induced angina
  12. # 10.   old peak = ST depression induced by exercise relative to rest
  13. # 11.   the slope of the peak exercise ST segment
  14. # 12.   number of major vessels (0-3) colored by fluoroscopy
  15. # 13.   thal: 3 = normal; 6 = fixed defect; 7 = reversable defect
  16. # 14.   target
  17.  
  18. #_______________________________________________________________________________
  19.  
  20. heart['cp'].value_counts()
  21.  
  22. # The result of the above line:
  23.  
  24. # 0    143
  25. # 2     87
  26. # 1     50
  27. # 3     23
  28. # Name: cp, dtype: int64
  29.  
  30. labels = ["Type 0","Type 1","Type 2","Type 3"]
  31. cp_types = heart['cp'].value_counts().values
  32. plt.pie(cp_types,autopct="%.1f%%", labels = labels)
  33. plt.title("Chest Pain Types")
  34. plt.show()
  35.  
  36. #As we can notice from the data chest pain type zero is the most common in our data
  37. #_______________________________________________________________________________
  38.  
  39. sns.countplot(x='sex',hue='target',data=heart)
  40. # As we can see in the plot the number of males who had heart disease is much greater than the number of females
  41.  
  42. #_______________________________________________________________________________
  43.  
  44.  
RAW Paste Data