Skip to content

Instantly share code, notes, and snippets.

@PranjalDureja0002
Created March 2, 2021 10:25
Show Gist options
  • Save PranjalDureja0002/dc6f62e2e24ff47bb75417010718f317 to your computer and use it in GitHub Desktop.
Save PranjalDureja0002/dc6f62e2e24ff47bb75417010718f317 to your computer and use it in GitHub Desktop.
eda
physician_count = outpatients_['AttendingPhysician'].value_counts().to_dict()
outpatients_['physician_count']=outpatients_['AttendingPhysician'].map(physician_count)
physician_count = inpatients_['AttendingPhysician'].value_counts().to_dict()
inpatients_['physician_count']=inpatients_['AttendingPhysician'].map(physician_count)
ax = sns.countplot(y='AttendingPhysician',data=outpatients_,hue='PotentialFraud',order = outpatients_['AttendingPhysician'].value_counts().head(20).index)
d1 = outpatients_['AttendingPhysician'].value_counts().to_dict()
s_s1 = sum(list(d1.values()))
for p in ax.patches:
percentage = '{:.1f}%'.format(100 * p.get_width()/s_s1)
x = p.get_x() + p.get_width() - 0.5
y = p.get_y() + p.get_height()
ax.annotate(percentage, (x, y))
ax.set_title('AttendingPhysician_ForOutpatients vs PotentialFraud')
ax = sns.countplot(y='AttendingPhysician',data=inpatients_,hue='PotentialFraud',order = inpatients_['AttendingPhysician'].value_counts().head(20).index)
d1 = inpatients_['AttendingPhysician'].value_counts().to_dict()
s_s1 = sum(list(d1.values()))
for p in ax.patches:
percentage = '{:.1f}%'.format(100 * p.get_width()/s_s1)
x = p.get_x() + p.get_width() - 0.5
y = p.get_y() + p.get_height()
ax.annotate(percentage, (x, y))
ax.set_title('AttendingPhysician_ForInpatients vs PotentialFraud')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment