0

I have

df = (pd.DataFrame({"Client":[0,1,0,1,0], 
"Phone" : ["IPhone", "Huawei", "IPhone", "Samsung", "Huawei"]}))
print(df)
   Client    Phone
0       0   IPhone
1       1   Huawei
2       0   IPhone
3       1  Samsung
4       0   Huawei

and 0 means that we lose a client and 1 that our client stay with as. I need table which present how many 0 and 1 has each brand of phone, so i need a table which first column is phone, second column is Client and column client is divided into 2 parts one for value "0" and second for value "1" and the last column which will sum value "0" for each brand of phone and value "1" for each brand of phone.

Umar.H
  • 22,559
  • 7
  • 39
  • 74
dingaro
  • 2,156
  • 9
  • 29

0 Answers0