"""
## Pima Indian Diabetes - Basic Exploratory Data Analysis
"""
"""
**Hello everyone!**

*In this notebook I will be performing a basic, beginner-friendly, Exploratory Data Analysis (EDA) on the PIMA INDIAN DIABETES Dataset.*
"""
"""
## Importing the liabraries
NumPy is used for handling Numbers and performing numerical analysis. It is the fundamental package for array computing with Python.

Pandas library should be imported.
Pandas are used to process the data. Pandas contains data structures and data manipulation tools designed for data cleaning and analysis.
"""
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
%matplotlib inline 
pima=pd.read_csv("../input/docspot/datasets_228_482_diabetes.csv")
pima.tail(10) #last 10 records of dataset
pima.head(10) #first 10 records of dataset
pima.shape #dimensions of the dataset
pima.size #total number of observations
pima.info() #different data types of all variables
pima.isnull().values.any() #checking for missing values
pima.iloc[:,0:8].describe() #summary of data present
#histogram plot for blood pressure
sns.displot(pima['BloodPressure'],kde=False,bins=6)
plt.show()
pima[pima['Glucose']==pima['Glucose'].max()]['BMI'] #BMI for person having highest glucose
m1 = pima['BMI'].mean()
print(m1)
m2 = pima['BMI'].median()
print(m2)
m3= pima['BMI'].mode()
print(m3)
#number of people above the mean level of 'Glucose'
pima[pima['Glucose']>pima['Glucose'].mean()].shape[0] 
#How many entries (people) have their 'BloodPressure' equal to the median of 'BloodPressure' and their 'BMI' less than the median of 'BMI'?
pima[(pima['BloodPressure']==pima['BloodPressure'].median()) & (pima['BMI']<pima['BMI'].median())].shape[0]
sns.pairplot(data=pima,vars=['Glucose', 'SkinThickness', 'DiabetesPedigreeFunction'],hue='Outcome')
plt.show()
plt.scatter(x='Glucose',y='Insulin',data=pima)
plt.show()
"""
## Plot a histogram for variable Age to understand the number of women in different Age groups given that they have and do not have diabetes. 
"""
plt.hist(pima[pima['Outcome']==1]['Age'], bins =5)
plt.title('Distribution of Pregnancies for Women who has Diabetes')
plt.xlabel('Age')
plt.ylabel('Frequency')
plt.show()
plt.hist(pima[pima['Outcome']==0]['Age'], bins =5)
plt.title('Distribution of Pregnancies for Women who dont have Diabetes')
plt.xlabel('Age')
plt.ylabel('Frequency')
plt.show()
"""
## Plotting a boxplot for the age variable
"""
plt.boxplot(pima['Age'])

plt.title('Boxplot of Age')
plt.ylabel('Age')
plt.show()
corr_matrix = pima.iloc[:,0:8].corr()

corr_matrix
sns.heatmap(corr_matrix, annot = True)

# display the plot
plt.show()
"""
## END OF THE EDA
"""
"""
**Hope you liked the Exploratory Data Analysis!**
"""