af = pd.merge(df, gdf, left_on='DA Code', right_on='DAUID', how='left')
af.to_file("output.geojson", driver="GeoJSON")
I am trying to export my geopandas dataframe adfter a merge. the orginal gdf is experting fine but the new one is giving me this error
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-47-85d4fd06b055> in <module>
----> 1 af.to_file("output.geojson", driver="GeoJSON")
/usr/local/lib/python3.7/dist-packages/pandas/core/generic.py in getattr(self, name)
5485 ):
5486 return self[name]
-> 5487 return object.getattribute(self, name)
5488
5489 def setattr(self, name: str, value) -> None:
AttributeError: 'DataFrame' object has no attribute 'to_file'
The merged gdf looks fine. Do I have to declare the geometry column manually?

afis not a gpd.GeoDataFrame it's a pd.DataFrame. Use geopandas merging, not pandas https://geopandas.org/en/stable/docs/user_guide/mergingdata.html – user2856 Nov 10 '22 at 03:27