[Python] Creating Point in GeoDataFrage gives Error: unhashable type: 'Point'

Discussão em 'Python' iniciado por Stack, Maio 2, 2025.

  1. Stack

    Stack Membro Participativo

    Im trying to create a new geodataframe with a point as one of the Attributes. It's all going to happen in a loop in the end, as I then want to concat multiple gdf's into one, but what is giving me a headache is this part:

    from shapely.geometry import Point
    import geopandas as gpd

    ptX = 13.435621213 #row2['geometry'].x
    ptY = 52.480377234 #row2['geometry'].y
    gdf_this = gpd.GeoDataFrame({('name', Point(ptX, ptY))})


    as it gives the Error: TypeError: unhashable type: 'Point'

    I assume it has something to do with the reference vs copy thing, so I've tried creating a temporary point first and then using

    gdf_this = gpd.GeoDataFrame({('name', copy.deepcopy(temp_point))})

    but that gives the same error.

    The documentation for shapely.Points lists a method reverse() which is supposed to return a copy of the geometry, but Point(ptX, ptY).reverse() gives the Error AttributeError: 'Point' object has no attribute 'reverse'?!?

    Continue reading...

Compartilhe esta Página