hpv2=( hpv .assign(sf=hpv.zjhm.str.startswith('62')) .query("jz_sj >= '2022-01-01' and jz_sj <= '2022-12-31'") .drop_duplicates(['zjhm']) .loc[:,'sjhm'] .dropna(axis=0) .drop_duplicates() .astype(str) .str.slice(0,11) ) # hpv.to_csv('/mnt/d/hpv.csv') # hpv=pd.read_csv('/mnt/d/hpv.csv') ( hpv2 .groupby('sf') .size() ) #API import requests import json import numpy as np url = 'https://api.uutool.cn/phone/location_batch' # data = {'phone': '18093189854,18919826420'} hpv2=hpv2.to_numpy() results=[] arrays = np.array_split(hpv2, len(hpv2) / 400) for a in arrays: data={} data['phone'] = ','.join(a) response = requests.post(url, data=data) results.append(json.loads(response.text)['data']['rows']) DF=pd.DataFrame(columns=['phone', 'isp', 'province', 'city','zip_code