I have a df with product ID, for each product I have some information, I need to keep only the first information !=0 within the group, all the others need to be set to zero. I am working with pandas.
This is the input:
| ID | Info |
|---|---|
| AA | 0 |
| AA | 20 |
| AA | 30 |
| BB | 10 |
| BB | 0 |
| BB | 20 |
This is the output i would like:
| ID | Info |
|---|---|
| AA | 0 |
| AA | 20 |
| AA | 0 |
| BB | 10 |
| BB | 0 |
| BB | 0 |
thank you for your help