0

Hey guys good morning.

I have this data set:

data = {'Dates':['2017-11-08','2017-11-09','2017-11-10','2017-11-13','2017-11-14','2017-11-15', '2017-11-08','2017-11-09','2017-11-10','2017-11-13','2017-11-14','2017-11-15', '2017-11-08','2017-11-09','2017-11-10','2017-11-13','2017-11-14','2017-11-15'], 'Category_data':["A","A","A","A","A","A","B","B","B","B","B","B","C","C","C","C","C","C"], 'Values_data':["1","3","4","6","1","1","6","1","1","5","3","1","6","1","1","6","1","1"]}

df = pd.DataFrame(data)

and I am trying to pivot it so that my columns become: Category_data, and Dates become the index, with values_data becoming values. The challenge is I get error duplicate values. So I'm wondering if there is a way to aggregate the data on Dates?

Objective output:

Date A B C
2017-11-08 1 2 3

etc....

Paul
  • 59
  • 5

0 Answers0