I am new to python and coding. I was doing a data analysis on a data set that resembles following set up.
EID Hours Block Participant
0 5443 1.0 STG. x
1 5443 1.0 STG. y
2 5402 3.5 BZP. a
3 5223 1.0 STG. z
I want the output table as:
Block Unique count. Unique sum
EID
BZP 1 3.5
STG 2 2.0
I am trying to use following code but not getting desired output
abc = df.groupby("Block").agg({'EID':['nunique'],'Hours':lambda x: sum(range(int(x.max())))})
Please help