'finding KPIs using Pandas in Python
I have datasets where I have tried to use the pandas groupby function to group the selected columns in the dataset. I would like to get the count of items in a particular column as part of the same dataframe. I can't seem to find a way. I am new to python and pandas. Thanks for the help.
example:-
country customer_no Treatment_Group Open Atlantis 1352202109 Group A 1 Atlantis 1354540751 Group B 1 Atlantis 1354849289 Group A 1 Oceania 1356553036 Group A 1 Oceania 1356553036 Group A 1 Oceania 1356553036 Group A 1 Oceania 1356883118 Group B 0 Oceania 1356883118 Group B 0
Group Country Rate (count opened/total unique customer))
A Atlantis (2/2)*100
A Oceania (1/1)*100 rate of distinct customer number who opened
B Atlantis (1/1)*100
B Oceania *0/1)*100
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
