Art distances from neighborhood center
Now that you have the center point and the art locations in the units we need to calculate distances in meters, it's time to perform that step.
Bu egzersiz, kursun bir parçasıdır
Visualizing Geospatial Data in Python
Egzersiz talimatları
- Import the package to help with pretty printing.
- Create a dictionary,
art_distancesby iterating throughart_dist_meters, usingtitleas the key and thedistance()fromcenteras the value. Passcenteras theotherargument toGeoSeries.distance(). - Pretty print
art_distancesusing thepprintmethod ofpprint.
Uygulamalı etkileşimli egzersiz
Bu egzersizi bu örnek kodu tamamlayarak deneyin.
# Import package for pretty printing
import ____
# Build a dictionary of titles and distances for Urban Residents art
art_distances = {}
for row in ____.iterrows():
vals = row[1]
key = vals['title']
ctr = vals[____]
art_distances[key] = vals['geometry'].distance(____)
# Pretty print the art_distances
____.____(art_distances)