0% found this document useful (0 votes)
10 views5 pages

Diabetics Data Analysis

Uploaded by

Linya C
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views5 pages

Diabetics Data Analysis

Uploaded by

Linya C
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

12/6/23, 1:34 PM Untitled13.

ipynb - Colaboratory

from google.colab import files


upload=files.upload()

Choose Files diabetes.csv


diabetes.csv(text/csv) - 23875 bytes, last modified: 11/24/2023 - 100% done
Saving diabetes.csv to diabetes.csv

import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
data=pd.read_csv('diabetes.csv')

data.shape

(768, 9)

data.head()

Pregnancies Glucose BloodPressure SkinThickness Insulin BMI DiabetesPedigree

0 6 148 72 35 0 33.6

1 1 85 66 29 0 26.6

2 8 183 64 0 0 23.3

3 1 89 66 23 94 28.1

4 0 137 40 35 168 43.1

data.drop('Pregnancies',axis=1,inplace=True)

data.drop('SkinThickness',axis=1,inplace=True)

data.drop('DiabetesPedigreeFunction',axis=1,inplace=True)

data.drop('BMI',axis=1,inplace=True)

data.head()

Glucose BloodPressure Insulin Age Outcome

0 148 72 0 50 1

1 85 66 0 31 0

2 183 64 0 32 1

3 89 66 94 21 0

4 137 40 168 33 1

sns.countplot(x='Outcome',data=data)

https://colab.research.google.com/drive/1FxpqoNG1HTbeQz732sQXAdRtS5t0jKHR?hl=en#scrollTo=ROMOimFEzT6X&printMode=true 1/5
12/6/23, 1:34 PM Untitled13.ipynb - Colaboratory

<Axes: xlabel='Outcome', ylabel='count'>

sns.countplot(x='Outcome',hue='Glucose',data=data)

https://colab.research.google.com/drive/1FxpqoNG1HTbeQz732sQXAdRtS5t0jKHR?hl=en#scrollTo=ROMOimFEzT6X&printMode=true 2/5
12/6/23, 1:34 PM Untitled13.ipynb - Colaboratory

<Axes: xlabel='Outcome', ylabel='count'>

sns.countplot(x='Outcome',hue='BloodPressure',data=data)

https://colab.research.google.com/drive/1FxpqoNG1HTbeQz732sQXAdRtS5t0jKHR?hl=en#scrollTo=ROMOimFEzT6X&printMode=true 3/5
12/6/23, 1:34 PM Untitled13.ipynb - Colaboratory

data.isnull()

https://colab.research.google.com/drive/1FxpqoNG1HTbeQz732sQXAdRtS5t0jKHR?hl=en#scrollTo=ROMOimFEzT6X&printMode=true 4/5
12/6/23, 1:34 PM Untitled13.ipynb - Colaboratory

Glucose BloodPressure Insulin Age Outcome


data.isnull().sum()
0 False False False False False

Glucose
1 False 0 False False False False
BloodPressure 0
2
Insulin False 0 False False False False
Age 0
3
Outcome False 0 False False False False
dtype: int64
4 False False False False False

... ... ... ... ... ...


pd.get_dummies(data['Glucose'])
763 False False False False False
0 44 56 57 61 62 65 67 68 71 ... 189 190 191 193 194 195 196 197
764 False False False False False
0 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0
765 False False False False False
1 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0
766 False False False False False
2 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0
767 False False False False False
3 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0
768 rows × 5 columns
4 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0

... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...

763 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0

764 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0

765 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0

766 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0

767 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0

768 rows × 136 columns

a=pd.get_dummies(data['Glucose'],drop_first=True)
print(a)

44 56 57 61 62 65 67 68 71 72 ... 189 190 191 \


0 0 0 0 0 0 0 0 0 0 0 ... 0 0 0
1 0 0 0 0 0 0 0 0 0 0 ... 0 0 0
2 0 0 0 0 0 0 0 0 0 0 ... 0 0 0
3 0 0 0 0 0 0 0 0 0 0 ... 0 0 0
4 0 0 0 0 0 0 0 0 0 0 ... 0 0 0
.. ... ... ... ... ... ... ... ... ... ... ... ... ... ...
763 0 0 0 0 0 0 0 0 0 0 ... 0 0 0
764 0 0 0 0 0 0 0 0 0 0 ... 0 0 0
765 0 0 0 0 0 0 0 0 0 0 ... 0 0 0
766 0 0 0 0 0 0 0 0 0 0 ... 0 0 0
767 0 0 0 0 0 0 0 0 0 0 ... 0 0 0

193 194 195 196 197 198 199


0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0
2 0 0 0 0 0 0 0
3 0 0 0 0 0 0 0
4 0 0 0 0 0 0 0
.. ... ... ... ... ... ... ...
763 0 0 0 0 0 0 0
764 0 0 0 0 0 0 0
765 0 0 0 0 0 0 0
766 0 0 0 0 0 0 0
767 0 0 0 0 0 0 0

[768 rows x 135 columns]

b=pd.get_dummies(data['Insulin'],)
print(b)

0 14 15 16 18 22 23 25 29 32 ... 495 510 540 \


0 1 0 0 0 0 0 0 0 0 0 ... 0 0 0
1 1 0 0 0 0 0 0 0 0 0 ... 0 0 0
2 1 0 0 0 0 0 0 0 0 0 ... 0 0 0
3 0 0 0 0 0 0 0 0 0 0 ... 0 0 0
4 0 0 0 0 0 0 0 0 0 0 ... 0 0 0
.. ... ... ... ... ... ... ... ... ... ... ... ... ... ...
763 0 0 0 0 0 0 0 0 0 0 ... 0 0 0
764 1 0 0 0 0 0 0 0 0 0 ... 0 0 0
765 0 0 0 0 0 0 0 0 0 0 ... 0 0 0
766 1 0 0 0 0 0 0 0 0 0 ... 0 0 0
767 1 0 0 0 0 0 0 0 0 0 ... 0 0 0

543 545 579 600 680 744 846


0 0 0 0 0 0 0 0

https://colab.research.google.com/drive/1FxpqoNG1HTbeQz732sQXAdRtS5t0jKHR?hl=en#scrollTo=ROMOimFEzT6X&printMode=true 5/5

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy