LoslegenKostenlos loslegen

Creating a Dask bag

You have been tasked with analyzing some reviews left on TripAdvisor. Your colleague has provided the reviews as a list of strings. You want to use Dask to speed up your analysis of the data, so to start with, you need to load the data into a Dask bag.

Diese Übung ist Teil des Kurses

Parallel Programming with Dask in Python

Kurs anzeigen

Anleitung zur Übung

  • Import the dask.bag subpackage as db.
  • Use the from_sequence() function to convert reviews_list into a Dask bag with 3 partitions.
  • Use the bag's .take() method to print a single element from the Dask bag.

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Import the Dask bag subpackage as db
____

# Convert the list to a Dask bag
review_bag = db.____(____, ____=____)

# Print 1 element of the bag
print(____)
Code bearbeiten und ausführen