I have a pandas dataframe like
ACCOUNT AMOUNT STATUS
1 -2 1
2 2 0
2 -1 0
1 2 1
1 2 1
This is would like to get converted into an dataframe like
ACCOUNT STATUS COUNT>0 COUNT<0 AMOUNT>0 AMOUNT<0
1 1 2 1 4 2
2 0 1 1 2 1
So basically split if AMOUNT is > or < than 0 and then count and sum the result. I currently have the following, but can't get the split AMOUNT right.
Data = pd.pivot_table(trans, values =['Status', 'AMOUNT'], index = ['ACCOUNT'], aggfunc = {'Status':np.mean, 'AMOUNT': [np.sum, 'count'] } )