-
-
Save PranjalDureja0002/9d949ac2f1f9a7760aaae1d9c88c05d2 to your computer and use it in GitHub Desktop.
eda
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| outpatient_data["age_group"]=pd.cut(outpatient_data.Age, [30,40,50,60,70,80,90,100]) | |
| inpatient_data["age_group"]=pd.cut(inpatient_data.Age, [30,40,50,60,70,80,90,100]) | |
| fraud_count = outpatient_data['PotentialFraud'].value_counts().to_dict() | |
| outpatient_data['fraud_Count']=outpatient_data['PotentialFraud'].map(age_count) | |
| s1 = inpatient_data['Gender'].value_counts() | |
| s_s1 = sum(s1.tolist()) | |
| s2 = outpatient_data['Gender'].value_counts() | |
| s_s2 = sum(s2.tolist()) | |
| plt.style.use('fivethirtyeight') | |
| counts = inpatient_data.groupby(['age_group', 'Gender']).Age.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 ('Age Group') | |
| plt.ylabel ('Co-Occurences ') | |
| plt.title('Inpatients In An Age Group Belonging to a specific gender',fontsize=20) | |
| plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment