Exploratory Data Analysis-Heart Disease

Monalisha Kumari
3 min readApr 23, 2022

Nowadays, Heart disease is the leading cause of death and according to the Centers for Disease Control and Prevention (CDC)Trusted Source, in the United States, 1 in every 4 deaths in is the result of a heart disease.

Common heart disease symptoms include:

  • dizziness
  • paleness
  • shortness of breath or shallow breathing
  • lightheadedness
  • fainting or passing out
  • anxiety

Heart Disease Analysis With Python

The dataset that I will be using here of heart disease is taken from Kaggle. Let’s start exploring the data-

Import libraries-

import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns

Import the dataset-

data = pd.read_csv(r"C:\Users\MONA\Downloads\heart.csv")

Top 5 Rows of dataset-

data.head()

Last 5 Rows of dataset-

data.tail()
#Information gives about total number of rows and columns;
# Datatypes of each column and Memory usage
data.info()
# This is visualization to check correlation by seaborn and matplotlib
#annot = true means to show data value
plt.figure(figsize=(17,7))
sns.heatmap(data.corr(),annot=True)
sns.countplot(data['sex'])
plt.xticks([0,1],['Female','Male'])
plt.show()
#Age distribution by seabornsns.distplot(data['age'],bins=20)
plt.show()
#To check chest pain type; typical angina is more common among peoplesns.countplot(data['cp'])
plt.xticks([0,1,2,3],['typical angina','atypical angina','non-anginal pain','asympotomatic'])
plt.xticks(rotation=70)
plt.show()

You can explore more and do analysis that can be done with this dataset and will be helpful to understand the reason for heart disease . I hope you like this article . And-

To check full exploratory data analysis ; Click on link given below-https://github.com/monalishakumari/Heart-Disease-Analysis

--

--