79296372

Date: 2024-12-20 06:45:26
Score: 1
Natty:
Report link

I used the fake data (df) below to compute the total number of injuries happening during the week-ends for each type of injury:

df

df = df.replace("Undisclosed", 0)  # replace the undisclosed value by 0
df = df[df["Weekday"].isin(["Saturday", "Sunday"])]  # filter on weekends
res = df.sum(axis=0)[2:]  # get the sum per column
print(res)

RoadTrafficAccident    213
Assault                252
DeliberateSelfHarm     215
SportsInjury           115
NotKnown               415
Reasons:
  • Probably link only (1):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: rehaqds