Python手机号码归属地查询

pip install phone #安装phone包


import phone


phone.Phone().find('00000000000')


{'area_code': '0531',
 'city': '济南',
 'phone': '00000000000',
 'phone_type': '联通',
 'province': '山东',
 'zip_code': '250000'}


import phone
def city(x):
    s='未知'
    try:
        s=phone.Phone().find(x)['city']
    except:
        pass
    return s
df1['城市']=df1.consignee_phone.map(city)

你可能感兴趣的:(pandas,python)