I’ve downloaded data from this link:
(https://data.cesko.digital/obce/1/obce.json)
Data has been successfully stored in a dictionary and when I try to extract coordinates (‘souradnice’) it acts like NoneType object and doesn’t allow me to do it using for loop. However if I try to print only one coordinate, it gives me no error. Where did I make a mistake?
url = 'https://data.cesko.digital/obce/1/obce.json'
resp = requests.get(url=url)
location_data = resp.json()
type(location_data)
x = list()
y = list()
for z in range(len(cz)):
y.append(cz[z][0])
x.append(cz[z][1])
I tried to find the information on forums, tried to convert coordinate data into a np.array but nothing seems to help.
2
Answers
Some municipalities contain
None
in their "souradnice" key so you have to check for that:You have missing values in your dataset that causes the bug if they are not dealt with.