My objective is very similar to these questions: here and here. The only real difference is I want to merge overlapping polygons if they are of the same class (an attribute).
For example, if polygons of different classes A and B overlap, they should be left as is, while if both are A or both are B, they should merged/dissolved.
geometry class
0 POLYGON ((233572.138 2710742.125, 233576.808 2... A
1 POLYGON ((233539.259 2710809.727, 233543.978 2... A
2 POLYGON ((233509.510 2710826.481, 233514.245 2... A
3 POLYGON ((233571.415 2710766.758, 233576.102 2... B
gp_polygon.dissolve(by='attribute')