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.
This exercise is part of the course
Parallel Programming with Dask in Python
Exercise instructions
- Import the
dask.bag
subpackage asdb
. - Use the
from_sequence()
function to convertreviews_list
into a Dask bag with 3 partitions. - Use the bag's
.take()
method to print a single element from the Dask bag.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Import the Dask bag subpackage as db
____
# Convert the list to a Dask bag
review_bag = db.____(____, ____=____)
# Print 1 element of the bag
print(____)