Basically the data set I have has 4 columns as below :-
| UID | Account | Name | Amount | 
|---|---|---|---|
| w1 | A1 | Rohit | 10 | 
| w2 | A1 | Rohit | 10 | 
| w3 | A2 | Rohit | 100 | 
| w4 | B1 | Sakshi | 10 | 
| w5 | B2 | Sakshi | 20 | 
| w6 | B3 | Sakshi | 30 | 
Now for each name I am trying to find using python
- count of distinct Accounts,
- sum of amount for those distinct accounts
- count of UIDs for each name
The output would look like something below
| Name | count of Account | count of UID | Sum of Amount | 
|---|---|---|---|
| rohit | 2 | 3 | 110 | 
| Sakshi | 3 | 3 | 60 | 
Till now I was able to get the counts using below snippet but couldn't calculate amount.
df = df.groupby('Name')['Account','Uid'].nunique()
