Skip to content
Advertisement

Pandas/Geopandas Merge with a mask selection

I usually work with Arcpy but am trying to learn more pandas/geopandas uses. I have a mask applied to a csv table and a shapefile that I want to merge together in order to find matches between the two based on a specific field.

However, when I try to merge them together, I get the error “The truth value of a Dataframe is ambiguous.” How do I merge a masked dataframe? I’ve included the segment of code below that creates the mask (utilizing two date variables and a date field) and the merge which uses the Location fields (different names on each dataframe).

What do I need to do to manipulate the mask dataframe into functioning in a mask?

JavaScript

Advertisement

Answer

  • have synthesized a MWE from your code. Generation and data frame and geo data frame
  • you have an error:
JavaScript
  • have used dataframe.merge() not pd.merge() hence only one data frame should be passed as a parameter
  • full working example below
JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement