I have a series of containing zip codes like
zip_codes = pd.Series(['10001', '1020', '98068'])
Now I have to compare it against a master table containing all the US zip codes and create a a Boolean series stating if a match is found or not.
zip_master = pd.DataFrame([['98292', 'Lake Ketchum'], ['98068', 'Roslyn'], ['99013', 99013]], columns=['Zip Code', 'City Name'])
Is there a vectorised way to do this? I looked into series string methods here, but could not figure out if its the right thing to use.
EDIT 1: As per the comments - we can use the dataframe method isin
So my main initial question is answered. I would like to extend this question little further. Is it possible to partial string matching in a vectorised way. Say I have a series containing city names and I want to match it against City Name of zip master. ? I have seen string matching being used like here- But its not vectorised. Is there any efficient vectorised method for it
Should I use some other technique like cacheing or data base to get this done?