Geopandas Dataframe Points to Polygons
<p>I have a geopandas dataframe made up of an id and a geometry column which is populated by 2D points. I want to join the points for each unique id to create a polygon, so that my new dataframe will have polygons as its geometry. My code currently looks something like this:</p>

<pre><code>polygons = geopandas.GeoDataFrame() 
for i in id:
    group = df[df['id']== i]
    polygon = {'type': 'Polygon', 'coordinates': group['geometry']}
    polygon['poly'] = polygon
    polygons = geopandas.concat([polygon,polygons])
</code></pre>

<p>It creates a polygon but when I assign the new variable <code>poly</code> it says</p>

<pre><code>ValueError: Length of values does not match length of index"
</code></pre>

<p>which makes sense since it is still just a list of coordinates and not an actual polygon object. Does anyone know how to make this an actual polygon object that I can add to a column on a geopandas <code>df</code>?<br>
Thanks in advance :)</p>