I have data like this, it's output of a groupby:
numUsers = df.groupby(["user","isvalid"]).count()
                      count     
user       isvalid               
5          0.0         1336  
           1.0          387 
But I need to have count of count_valid and count_invalid columns for each user, like this:
                    count_valid  count_invalid
user 
5                           387           1336
           
How can I do it in optimized way in Pandas?
 
     
    