MulaiMulai sekarang secara gratis

In which district in the Eiffel Tower located?

Let's return to the Eiffel Tower example. In previous exercises, we constructed a Point geometry for its location, and we checked that it was not located in the Montparnasse district. Let's now determine in which of the districts of Paris it is located.

The districts GeoDataFrame has been loaded, and the Shapely and GeoPandas libraries are imported.

Latihan ini adalah bagian dari kursus

Working with Geospatial Data in Python

Lihat Kursus

Petunjuk latihan

  • Create a boolean mask (or filter) indicating whether each district contains the Eiffel Tower or not. Call the result mask.
  • Filter the districts dataframe with the boolean mask and print the result.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Construct a point object for the Eiffel Tower
eiffel_tower = Point(255422.6, 6250868.9)

# Create a boolean Series
mask = ____

# Print the boolean Series
print(mask.head())

# Filter the districts with the boolean mask
print(____)
Edit dan Jalankan Kode