IniziaInizia gratis

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.

Questo esercizio fa parte del corso

Parallel Programming with Dask in Python

Visualizza il corso

Istruzioni dell'esercizio

  • 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.

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

# Import the Dask bag subpackage as db
____

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

# Print 1 element of the bag
print(____)
Modifica ed esegui il codice