Skip to content

Instantly share code, notes, and snippets.

@PranjalDureja0002
Created March 15, 2021 09:35
Show Gist options
  • Save PranjalDureja0002/78f999e0518ef233b14e2b95a54a6180 to your computer and use it in GitHub Desktop.
Save PranjalDureja0002/78f999e0518ef233b14e2b95a54a6180 to your computer and use it in GitHub Desktop.
eda
s1 = outpatient_data['InscClaimAmtReimbursed'].value_counts()
s_s1 = sum(s1.tolist())
s2 = inpatient_data['InscClaimAmtReimbursed'].value_counts()
s_s2 = sum(s2.tolist())
outpatient_data["amountgrp"]=pd.cut(outpatient_data.InscClaimAmtReimbursed, [0,50,100,200,400,600,800,1000,1500,2000])
inpatient_data["amountgrp"]=pd.cut(inpatient_data.InscClaimAmtReimbursed, [0,2000,4000,6000,8000,10000,12000,14000,16000])
plt.style.use('fivethirtyeight')
counts = outpatient_data.groupby(['amountgrp', 'PotentialFraud']).InscClaimAmtReimbursed.count().unstack()
print(counts)
ax = counts.plot(kind='bar',stacked = False, colormap = 'Paired')
total = s_s1
for p in ax.patches:
percentage = '{:.1f}%'.format(100 * p.get_height()/total)
x = p.get_x() + p.get_width() - 0.5
y = p.get_y() + p.get_height()
ax.annotate(percentage, (x, y))
plt.xlabel ('Claims_reimbursed')
plt.ylabel ('Co-Occurences ')
plt.title('Claims_reimbursed_for_Outpatients',fontsize=20)
plt.show()
plt.style.use('fivethirtyeight')
counts = inpatient_data.groupby(['amountgrp', 'PotentialFraud']).InscClaimAmtReimbursed.count().unstack()
print(counts)
ax = counts.plot(kind='bar',stacked = False, colormap = 'Paired')
total = s_s2
for p in ax.patches:
percentage = '{:.1f}%'.format(100 * p.get_height()/total)
x = p.get_x() + p.get_width() - 0.5
y = p.get_y() + p.get_height()
ax.annotate(percentage, (x, y))
plt.xlabel ('Claims_reimbursed')
plt.ylabel ('Co-Occurences ')
plt.title('Claims_reimbursed_for_Inpatients',fontsize=20)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment