I have the following dataframe:
| id | expNumber | attempt | finished | successful |
|---|---|---|---|---|
| 1 | 1 | 1 | true | false |
| 1 | 1 | 2 | false | false |
| 1 | 1 | 3 | true | true |
| 1 | 2 | 1 | false | false |
| 1 | 2 | 2 | true | false |
| 1 | 2 | 3 | true | true |
| 1 | 4 | 1 | false | false |
| 1 | 4 | 2 | false | false |
id,expNumber,attempt,finished,successful,
1,1,1,true,false,
1,1,2,false,false,
1,1,3,true,true,
1,2,1,false,false,
1,2,2,true,false,
1,2,3,true,true,
1,4,1,false,false,
1,4,2,false,false,
And I want to create a dataframe which counts the data grouped by the value of the column. Here is what I expect:
| true | 4 |
| false | 4 |
I tried the following code but when I print the result, its just empty.
df = df.groupby('finished'.sum())
print("test", df)