mardi 21 mai 2019

Condition using df index range

I want to add region column to df1 using ip range stated in df2.given two data frames: df1 has ip_address df2 has ip_from, ip_to, region

can you make a conditional statement using indexes? if df1.ip[0] is in between specific ip, add region in df1? I am guessing there should be a loop in the if statement so that it can loop through df2 to see where the ip ranges are and grab the region.

Please help. Thank you

Aucun commentaire:

Enregistrer un commentaire