I have a simple geopandas
dataframe that includes geometry and a column called 'MUKEY'
:
merged_spatial_df.head()
I want to merge it to a tabular (.csv) pandas
dataframe (which also has a column called 'MUKEY'
) based on 'MUKEY'
.
merged_tab_df.head()
There are 31,000 rows in merged_spatial_df and about 391 in merged_tab_df, but each unique MUKEY
value in merged_tab_df corresponds to one in merged_spatial_df. I tried the following but can't seem to merge them together and .sjoin
requires 2 geodataframes. I tried:
merged_master = gpd.GeoDataFrame(merged_tab_df.merge(merged_spatial_df, how='right'))
but I got an error - ValueError: You are trying to merge on int64 and object columns. If you wish to proceed you should use pd.concat
, so I tried:
merged_master = gpd.GeoDataFrame(pd.concat([merged_tab_df, merged_spatial_df], join ='inner'))
None of the concats I tried produced viable results. What am I doing wrong here?