GeoDataFrame बनाना और geometry को परखना
आइए देखें कि Nashville में service districts कहाँ हैं। Service district shapefile का path वैरिएबल shapefile_path में स्टोर है।
यह अभ्यास पाठ्यक्रम का हिस्सा है
Python में Geospatial Data का Visualization
अभ्यास निर्देश
geopandasको इसके सामान्य उपनामgpdके साथ import करें।geopandasका उपयोग करके service district shapefile पढ़ें औरhead()मेथड से शुरुआती 5 पंक्तियाँ देखें।- पहली पंक्ति (rowname '0') में geometry फ़ील्ड प्रिंट करें ताकि उस फ़ील्ड में मौजूद डेटा देख सकें। इसके लिए आप
service_district.loc[0, 'geometry']कोprint()फंक्शन में पास करेंगे।
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
# Import geopandas
import ____ as ____
# Read in the services district shapefile and look at the first few rows.
service_district = gpd.____(shapefile_path)
print(service_district.____())
# Print the contents of the service districts geometry in the first row
print(service_district.loc[0, '____'])