I have data frame, df
, that looks like this:
Done Todo Total
Painting 55 54 109
Fitting 17 26 43
Plumbing 10 26 36
Electricity 7 29 36
Piping 29 5 34
Roofing 12 20 32
I need to merge indexes 'Plumbing' and 'Piping' so that I have a data frame that looks like this:
Done Todo Total
Painting 55 54 109
Fitting 17 26 43
Plumbing 39 46 68
Electricity 7 29 36
Piping 29 5 34
How can I achieve this is pandas?
I have tried the following
df.loc['Plumbing'] = df.loc['Plumbing'] + df.loc['Piping']
but this keeps the 'Piping' row in the data frame. Is there a way of doing it automatically so that the 'Piping row is automatically removed? This and this questions did not provide what I need.