Created
March 23, 2021 09:30
-
-
Save HeenaR17/bd9812927dc5d29e5e772054e7c5add7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Correlation | |
#loading dataset | |
import seaborn as sns | |
df=pd.read_csv(r"C:\Users\heena\Downloads\diabetes1.csv") | |
df.shape | |
# Output: (768, 9) | |
df.corr() | |
#Output: Pregnancies Glucose BloodPressure SkinThickness Insulin BMI DiabetesPedigreeFunction Age Outcome | |
#Pregnancies 1.000000 0.128311 0.141282 -0.081672 -0.073535 0.017683 -0.033523 0.544341 0.221898 | |
#Glucose 0.128311 1.000000 0.152446 0.058441 0.330940 0.223410 0.137096 0.263705 0.466401 | |
#BloodPressure 0.141282 0.152446 1.000000 0.207371 0.088933 0.281805 0.041265 0.239528 0.065068 | |
#SkinThickness -0.081672 0.058441 0.207371 1.000000 0.436783 0.392573 0.183928 -0.113970 0.074752 | |
#Insulin -0.073535 0.330940 0.088933 0.436783 1.000000 0.197859 0.185071 -0.042163 0.130548 | |
#BMI 0.017683 0.223410 0.281805 0.392573 0.197859 1.000000 0.140647 0.036242 0.292695 | |
#DiabetesPedigreeFunction -0.033523 0.137096 0.041265 0.183928 0.185071 0.140647 1.000000 0.033561 0.173844 | |
#Age 0.544341 0.263705 0.239528 -0.113970 -0.042163 0.036242 0.033561 1.000000 0.238356 | |
#Outcome 0.221898 0.466401 0.065068 0.074752 0.130548 0.292695 0.173844 0.238356 1.000000 | |
# We see that age and pregnancies are the most related features, whereas some others like age and skin thickness are inversely correlated. | |
# To view the results graphically | |
sns.pairplot(df) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment