Get startedGet started for free

Running different cell types

DataLab notebooks allow you to run various types of cells, each producing different outputs. In this exercise, you’ll execute Python and SQL cells to produce dataframes, visualizations, and text outputs.

This exercise is part of the course

Introduction to DataLab

View Course

Exercise instructions

Run the following cells:

  • A Code cell that loads a dataset.
  • A SQL cell that queries the dataset.

Now copy the below code to the empty Code cell and run that cell to create a visualization.

import matplotlib.pyplot as plt
ratings_count = sql_output['rating'].value_counts().sort_index()

plt.figure(figsize=(10, 6))
plt.bar(ratings_count.index, ratings_count.values)
plt.title("Number of movies by rating")
plt.xlabel("Movie Rating")
plt.ylabel("Number of movies")
plt.show()

Observe the different output formats produced. Continue when you've had a play.

Hands-on interactive exercise

Turn theory into action with one of our interactive exercises

Start Exercise