0

I already have this df with only three types of frame_code: P20, P60 and EV9

      bus frame_code
0   U0032        EV9
1   U6762        P20
2   U1438        P20
3   U4623        P20
4   U1791        P20
..    ...        ...
88  U3804        P20
89  U4065        P20
90  U1035        P20
91  U0032        P20
92  U0032        P60

I need to group in the next df:

bus    P20  P60  EV9
U0032   2    1    1
U0762   1    0    0
.       .    .    .

I already tried using group_by df = df[["bus", "frame_code"]].groupby(["frame_code"]), however I couldn't achieve the proper result

Ajeet Verma
  • 2,938
  • 3
  • 13
  • 24

0 Answers0