jeudi 3 juillet 2014

Grouping a column by boolean comparison


Vote count:

0




I have a dataframe in Pandas that has the following format (with a bunch of other columns as well)



chip WL ok
0 1 1 True
1 1 2 True
2 1 3 True
3 1 4 True
4 2 1 False
5 2 2 True
6 2 3 True
7 2 4 True


I want to group by chip, count the number of WLs for each chip, and do a logical and on each value in the ok columns. The expected output should look like this:



chip WLs ok
0 1 4 True
1 2 4 False


How do I do this?



asked 1 min ago

veor

56





Aucun commentaire:

Enregistrer un commentaire