Compare columns in two dataframes to set values in one from another

Viewed 24

I need to take values from a larger database, coor, and add them to an existing column in a smaller one, xshooter, where the entries match. I'm using RA columns in both to find the matching instances. I need a way to rewrite the for loops using pandas functions to reduce runtime.

for j in coor.index:
  for i in xshooter_master_tabl.index:
    if coor['RA_ICRS'][j] == xshooter_master_tabl['ra'][i]:
      xshooter_master_tabl['star_id'][i] = coor['SimbadName'][j]
0 Answers
Related