Python 无法将Pandas列中的IP地址转换为latlng(经纬度)

Python 无法将Pandas列中的IP地址转换为latlng(经纬度),python,pandas,dataframe,latitude-longitude,geocode,Python,Pandas,Dataframe,Latitude Longitude,Geocode,我试图将Pandas列中的数据(每行包含IP地址)转换为纬度和经度。以下是我的代码: import geocoder d = pd.DataFrame({'ip_address' : ['49.206.217.180', '200.8.245.246', '186.188.35.217']}) d['coordinate'] = d.apply(geocoder.ip(d['ip_address'].latlng)) 运行这些代码后,我得到了一个错误 AttributeError:“Se

我试图将Pandas列中的数据(每行包含IP地址)转换为纬度和经度。以下是我的代码:

import geocoder

d = pd.DataFrame({'ip_address' : ['49.206.217.180', '200.8.245.246', '186.188.35.217']})

d['coordinate'] = d.apply(geocoder.ip(d['ip_address'].latlng)) 
运行这些代码后,我得到了一个错误

AttributeError:“Series”对象没有属性“latlng”

我不知道为什么会这样。有人能给我一些反馈吗?非常感谢

import geocoder

d = pd.DataFrame({'ip_address' : ['49.206.217.180', '200.8.245.246', '186.188.35.217']})
d['coordinate'] = d['ip_address'].apply(lambda x: geocoder.ip(x).latlng)