-1

I've a sample data

name      city      status      entry_no
John       NY       active        1
John       NY       in_active     2
John       Canada   in_active     1
Max        DC       delivered     1
Max        DC       in_active     2

How can I transform the above dataframe to

name     city       1           2         3
John      NY      active     in_active
John     Canada  in_active
Max       DC     delivered   in_active

I've tried pivot_table which is not of use.

Edit: I'm very aware of pivot_table function, but it doesn't give the desired dataframe. So I'd like to whether it could be possible.

0 Answers0