I'm calculating the distance from a point to other points and I keep them in a matrix, how can I get the minimum value by taking the distance it contains, I should show that data found the distance the name and the address of the lowest value
lista=[]
lista += [distancia,nombre,direccion]
The values that are stored as an example are the following.
<class 'list'>: [0.5989068259400513, 'YPF - Torre Blanca', 'C1049AAP, Alem 744']
<class 'list'>: [1.5000067783445622, 'YPF - Torre Blanca', 'C1049AAP, Tucumán 466']
<class 'list'>: [4.6825980651789, 'YPF - Torre Blanca', 'C1049AAP, Parana 890']
<class 'list'>: [0.9999068259400518, 'YPF - Torre Blanca', 'C1049AAP, Lavalle 147']
etc ..
Thanks for the help.
Edit:
for lugar in busquedajson['results']:
nombre=lugar['name']
direccion=lugar['vicinity']
#Point one
latJson = lugar['geometry']['location']['lat']
lonJson = lugar['geometry']['location']['lng']
distancia = gpxpy.geo.haversine_distance(latJson,lonJson,r[1],r[0])
metros = int(float(distancia))
lista=[]
lista += [metros,nombre,direccion]
#archivolugares.write(lugar['name'] + ',' + str(lugar['geometry']['location']['lng']) \
#+ ',' + str(lugar['geometry']['location']['lat']) + '\n')
minimo = min ( ((i , lista[ i ]) for i in range ( 0 , len ( lista ) , 3 )) , key=itemgetter ( 1 ) )[ 0 ]
print ( lista[ minimo:minimo + 3 ] )