I wrote the command bellow :
pd.DataFrame(df.groupby(['CHAUFFEUR','comportement de conduit'])['comportement de conduit'].count())
I get the dataframe bellow :
| CHAUFFEUR | comportement de conduit | comportement de conduit |
|---|---|---|
| ABBAD DJELLOUL | bad driving behaviour(reduce your acceleration) | 1 |
| ABBOU ABD EL KADER | bad driving behaviour | 5 |
| bad driving behaviour(reduce your acceleration,increase your speed) | 14 | |
| ... | ... | ... |
| ZIANE ABDELKADER | good driving behaviour(try to reduce acceleration) | 18 |
| normal driving behaviour | 24 | |
| very good driving behaviour | 4 |
Now I need to select for each CHAUFFEUR all numbers of his comportement de conduit for example for the second CHAUUFEUR named ABBOU ABD EL KADER i need to select only :
| bad driving behaviour | 5 |
| bad driving behaviour(reduce your acceleration) | 41 |
So how can I do it please