Skip to content
Advertisement

Pandas Merge to Determine if Value exists

I have checklist form data coming into a spreadsheet that I am trying to determine if a specific value was not checked and provide info based off that. My first thought was to have a master list/df where all the form values are then do a left/right merge on each response to determine values that weren’t there.

Sample data and script. Expecting nan/NA for the missing Address response in the second set, with 6 rows instead of the original 5.

JavaScript

Advertisement

Answer

You can do this by constructing your own MultiIndex and performing a .reindex operation.

JavaScript
Advertisement