I have a huge dataframe and i want to merge only two rows in it based on if condition. Below is a sample data frame and when I tried to do groupby sum other rows are also getting effected.
I only want column jb_name with generic to get merged and sum.
jb_name jb_count
0 generic 10
1 generic1 2
2 generic 15
3 other 14
tried the following but as i said its effecting other rows as well
df = df.groupby(['jb_name'])['jb_count'].sum().reset_index()
I want the final df as following
jb_name jb_count
0 generic 25
1 generic1 2
3 other 14