Issue
I am a Pandas newbie and I like it a lot. I am trying to create a pivot table and having trouble. This is a small image file explaining my problem:
I have tried the following line but it doesn't output the way I want.
df = df.pivot_table(index = 'Time', columns = 'Item', values = 'Value', aggfunc = list)
Solution
try this:
output = pd.pivot_table(df, values='Value', index=['Time', 'ID'],
columns=['Item'], aggfunc=np.sum, fill_value="")
Answered By - Shireen
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.