0

Given data frame:

Group count status Duration
A 2 1 2.4
A 4 0 7
A 2 1 4
B 3 1 6
B 2 0 7
df.groupby("Group")["Duration"].max()

Expected Result data frame:

Group count status Duration
A 4 0 7
B 2 0 7
skye
  • 77
  • 8

1 Answers1

0

You'll also need as_index=False to prevent the group columns from becoming the index in your output.

df.groupby("Group",as_index=False)[["count","status","Duration"]].max()
Gaston Alex
  • 151
  • 1
  • 6