0

i have a df as: production_unit_id|defective_item|defective_item_count|items_produced_count|items_discarded_count

P108|rock|46|1|315

P108|scissor|47|3|309

P108|rock|27|6|315

P085|scissor|50|8|194

P774|scissor|23|146|21

P774|scissor|5|146|21

i want the output as: production_unit_id|defective_item|defective_item_count|items_produced_count|items_discarded_count

P108|rock|73|7|630

P108|scissor|47|3|309

P085|scissor|50|8|194

P774|scissor|28|292|42

the 'defective_item' column should be grouped and 'defective_item_count' should be added corresponding to the same 'defective_item' .

Please help. Thanks in advance.

0 Answers0