Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created July 14, 2020 11:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codecademydev/14053a9624e68650d2e780bb6ed4db7f to your computer and use it in GitHub Desktop.
Save codecademydev/14053a9624e68650d2e780bb6ed4db7f to your computer and use it in GitHub Desktop.
Codecademy export
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']
alabama_chest_pain = chest_pain[chest_pain['Provider State'] == "AL"]
costs = alabama_chest_pain[' Average Covered Charges '].values
plt.boxplot(costs)
plt.show()
states = chest_pain["chest_pain"].unique()
datasets = []
for state in states:
datasets.append(chest_pain[chest_pain['Provider State'] == state][' Average Covered Charges '].values)
plt.figure(figsize=(20,6))
plt.boxplot(datasets, labels = states)
plt.show()
plt.boxplot(' Average Covered Charges ', 'Average Medicare Payments')
plt.show()
@Balatonia
Copy link

You should replace the code:
states = chest_pain["chest_pain"].unique()

with:
states = chest_pain["Provider State"].unique()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment