I've dataframe with name loaddata1 with column "IP_Adress" containing IP's in it and I want another column with name "city" which will display corresponding city based on Ip_adress. Can some suggest proper code. I've used below code but its not working. Also "IP_Adress" column is blank for some of record.
loaddata1 = pd.DataFrame({'ip': loaddata1['IP_Adress']})
loaddata1['city'] = loaddata1.loc[loaddata1['ip'].notna(), 'ip'].apply(lambda x: geocoder.ip(x).city) print(loaddata1['IP_Adress'], loaddata1['city'])
`
Still getting Error enter image description here enter image description here