So I've created a dataframe which contains only postcodes and I'm using an api that outputs longitude/latitude json info when I feed it the postcodes df. I've created a function for this converter and used panda apply on it. I can only print my dataframe if I drop everything but the first 1000 rows.
#code only works if I trim it down to first 1000
#geo_data.drop(geo_data.index[1000:33227],inplace=True)
def postcode_converter(x):
longitude,latitude= None,None
new_url='https://api.getthedata.com/postcode/'+str(x)
new_url=new_url.strip()
r = requests.get(new_url)
time.sleep(0.1)
r= r.text
try:
result= json.loads(r)
longitude=result['data']['longitude']
latitude=result['data']['latitude']
except Exception:
pass
return (longitude,latitude)
geo_data['longitude'],geo_data['latitude']=zip(*geo_data['postcode'].apply(postcode_converter))
print(geo_data)