पड़ोस के केंद्र से आर्ट की दूरियाँ
अब जबकि आपके पास सेंटर पॉइंट और आर्ट लोकेशन ऐसे यूनिट्स में हैं जिनमें हम मीटर में दूरी निकाल सकते हैं, तो अब उस स्टेप को करने का समय है।
यह अभ्यास पाठ्यक्रम का हिस्सा है
Python में Geospatial Data का Visualization
अभ्यास निर्देश
- प्रिटी प्रिंटिंग में मदद करने वाला पैकेज इम्पोर्ट करें.
art_dist_metersपर इटरेट करकेart_distancesनाम का एक डिक्शनरी बनाएँ, जिसमेंtitleको key औरcenterसेdistance()को value रखें.GeoSeries.distance()मेंotherआर्ग्युमेंट के रूप मेंcenterपास करें.pprintकीpprintमेथड का उपयोग करकेart_distancesको प्रिटी प्रिंट करें.
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
# 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)