-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstatistic-boxplot
36 lines (28 loc) · 959 Bytes
/
statistic-boxplot
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import codecademylib3_seaborn
import pandas as pd
from matplotlib import pyplot as plt
healthcare = pd.read_csv("healthcare.csv")
#print(healthcare.head())
print(healthcare["DRG Definition"].unique())
chest_pain = healthcare[healthcare['DRG Definition'] == '313 - CHEST PAIN']
#print(chest_pain)
alabama_chestpain=chest_pain[chest_pain['Provider State']=='AL']
#print(alabama_chestpain)
plt.boxplot(alabama_chestpain[' Average Covered Charges '].values)
#plt.show()
unique=chest_pain['Provider State'].unique()
print(unique)
'''
for state in unique:
state_chestpain=chest_pain[chest_pain['Provider State']==state]
plt.clf()
plt.boxplot(state_chestpain[' Average Covered Charges '].values)
plt.show()
'''
datasets=[]
for state in unique:
datasets.append(chest_pain[chest_pain['Provider State']==state][' Average Covered Charges '])
plt.figure(figsize=(20,6))
plt.boxplot(datasets,labels=unique)
#plt.set_xticks(unique)
plt.show()