This is my
dataframe
Date Name Count
0 Sep-2015 Adam 3
1 Sep-2015 David 3
2 Sep-2015 Adam 4
3 Sep-2015 Adam 3
4 Sep-2015 David 6
5 Sep-2015 Hardik 1
6 Sep-2015 David 3
Now I want to unique
Namewith respect toDateand enter in otherdataframe. I tried this
df = pd.DataFrame((['Sep-2015', 'Adam',3 ],
['Sep-2015', 'David',3],
['Sep-2015', 'Adam',4],
['Sep-2015', 'Adam' ,3],
['Sep-2015', 'David',6],
['Sep-2015' , 'Hardik',1],
['Sep-2015' , 'David' ,3]),columns=['Date','Name','Count'])
df = df.drop_duplicates(['Date', 'Name'], keep='last')
df2 = pd.DataFrame ({i : [j for j in df['Count']] for i in df['Name']},index = [i for i in df['Date']])
I am getting this
Adam Hardik David
Sep-2015 3 3 3
Sep-2015 1 1 1
Sep-2015 3 3 3
Here data entry is somewhere wrong. The following is the expected output.
Adam Hardik David
Sep-2015 3 1 3