I have a dataset with multiple columns but there is one column named 'City' and inside 'City' we have multiple (city names) and another column named as 'Complaint type' and having multiple types of complaints inside this, and i have to convert the all unique cities into columns and all unique complaint types as rows.
and there is a 'Unique Key' variable which is assigned to each complaint.
Please help me with the proper codes.
df_new=df.pivot_table(index='Complaint Type',columns='City',values='Unique Key')
df_new
I did this and worked but is there any other way to do it as it is not clear to me