Get startedGet started for free

Restaurants in Paris

Throughout the exercises in this course, we will work with several datasets about the city of Paris.

In this exercise, we will start with exploring a dataset about the restaurants in the center of Paris (compiled from a Paris Data open dataset). The data contains the coordinates of the point locations of the restaurants and a description of the type of restaurant.

We expect that you are familiar with the basics of the pandas library to work with tabular data (DataFrame objects) in Python. Here, we will use pandas to read the provided csv file, and then use matplotlib to make a visualization of the points. With matplotlib, we first create a figure and axes object with fig, ax = plt.subplots(), and then use this axes object ax to create the plot.

This exercise is part of the course

Working with Geospatial Data in Python

View Course

Exercise instructions

  • Import pandas as pd and matplotlib.pyplot as plt.
  • Read the restaurants dataset ("paris_restaurants.csv") and assign it to a variable called restaurants.
  • Inspect the first 5 rows of the df dataframe with the head() method. Do you see the columns with coordinates?
  • Make a quick visualization of the locations of the districts using the matplotlib plot() method.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Import pandas and matplotlib
____
____

# Read the restaurants csv file
restaurants = ____

# Inspect the first rows of restaurants
print(____)

# Make a plot of all points
fig, ax = plt.subplots()
ax.plot(____, ____, 'o')
plt.show()
Edit and Run Code