शुरू करेंमुफ़्त में शुरू करें

Map Nashville neighborhoods

This time you'll read a GeoJSON file in to a GeoDataFrame to take a quick peek at where Nashville neighborhoods are.

यह अभ्यास पाठ्यक्रम का हिस्सा है

Visualizing Geospatial Data in Python

पाठ्यक्रम देखें

अभ्यास निर्देश

  • Import geopandas and matplotlib.pyplot using the customary aliases.
  • Read in the neighborhoods GeoJSON file to a GeoDataFrame called neighborhoods and print the first few rows with .head(). The path to this file is stored in a variable called neighborhoods_path.
  • Plot neighborhoods coloring the polygons by the name column of the GeoDataFrame and using the Dark2 color map. This time, don't include a legend.
  • Show the plot.

इंटरैक्टिव व्यावहारिक अभ्यास

इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।

import geopandas as _____
import matplotlib.pyplot as _____

# Read in the neighborhoods geojson file
neighborhoods = gpd._____(neighborhoods_path)

# Print the first few rows of neighborhoods
print(neighborhoods.____())

# Plot the neighborhoods, color according to name and use the Dark2 colormap
neighborhoods.plot(_____ = 'name', _____ = 'Dark2')

# Show the plot.
plt.show()
कोड संपादित करें और चलाएँ