samedi 22 décembre 2018

Matching Cells Based on Zip Codes From 2 Data Frames [duplicate]

This question already has an answer here:

I am trying to write a for loop to append the cells of the OH zip spreadsheet to the akron_table spreadsheet based on whether the zipcodes in both spreadsheets match. The problem is that my code returns blank results for each of the columns that I created in the akron_table data frame.

for column in list(OH_zip_table.columns):
   for cell in OH_zip_table[column]:
       for zip1 in OH_zip_table['RESIDENTIAL_ZIP']:
           akron_table.loc[akron_table['RESIDENTIAL_ZIP'] == zip1, column] = cell

I want a data frame with columns showing the matched cells in the akron_table data frame. Can you show me an alternative to this for loop that works?

Aucun commentaire:

Enregistrer un commentaire