Professional Documents
Culture Documents
Rahil 538
Rahil 538
import numpy as np
In [2]: df = pd.read_excel('Group-8.xlsx')
df.head()
Out[2]: Patient Id Age Gender Air Pollution Alcohol use Dust Allergy OccuPational Hazards Genetic Risk chronic Lung Disease Balanced Diet ... Fatigue Weight Loss Shortness of Breath Wheezing Swallowing Difficulty Clubbing of Finger Nails Frequent Cold Dry Cough Snoring Level
0 P1 33 1 2 4 5 4 3 2 2 ... 3 4 2 2 3 1 2 3 4 Low
5 rows × 25 columns
ageBelow = len(age)
nummalesex = len(malesex)
numfemalesex = len(femalesex)
numofgeneticrisks = len(geneticrisks)
In [ ]: #charts
print(highrisk)
lowrisk = df['Level'].value_counts()['Low']
mediumrisk = df['Level'].value_counts()['Medium']
print(mediumrisk)
365
303
332
y=[365,332,303]
plt.xlabel("genetic level",loc="center")
plt.ylabel("number of patients",loc="center")
plt.bar(x,y,color="c")
plt.draw()
In [8]: plt.pie(y,labels=x,autopct='%1.1f%%',pctdistance=0.6,labeldistance=1.1)
plt.show()
In [30]: series=pd.Series([598,402])
series_mean=series.mean()
Pandas Series:
0 598
1 402
dtype: int64
500.0