From a geopandas
dataset I would like to join polygons into a single polygon when they meet the condition that they are in close proximity (touching).
The following picture gives the before (A) and after(B):

Remark that the result of the join are two polygons as small yellow areas are touching each other so are grouped into one polygon.
I give a toy data example to test this:
import pandas as pd
from shapely import geometry
df = pd.DataFrame({"id":["poly_b1","poly_b2","poly_b3","poly_a"],
"geom":[geometry.Polygon([(3, 0), (3, 3), (5, 3), (5, 0)]),
geometry.Polygon([(0, 0), (3, 10), (3, 0)]),
geometry.Polygon([(5, 3), (5, 5), (7, 5), (5, 0)]),
geometry.Polygon([(15, 13), (15, 15), (17, 15), (15, 10), (12,2)])]})