Parquet से Dask DataFrames पढ़ें
Chapter 1 में, आपने कुछ Spotify डेटा का विश्लेषण किया था, जो कई फाइलों में बँटा था, ताकि 2005–2020 के टॉप हिट्स निकाले जा सकें. आपने यह काम dask.delayed() फंक्शन और एक loop का इस्तेमाल करके किया था. अब देखें कि Dask DataFrames से यही विश्लेषण कितना आसान हो जाता है.
dask.dataframe आपके लिए dd नाम से import किया गया है.
यह अभ्यास पाठ्यक्रम का हिस्सा है
Python में Dask के साथ Parallel Programming
अभ्यास निर्देश
"data/spotify_parquet"में स्थित Parquet डेटा फ़ोल्डर लोड करें.- DataFrame की
.nlargest()मेथड का उपयोग करके'popularity'के आधार पर टॉप 10 गाने निकालें. - delayed ऑब्जेक्ट को compute करके उसे pandas DataFrame में बदलें.
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
# Read the spotify_parquet folder
df = ____
# Find the 10 most popular songs
top_10_songs = ____
# Convert the delayed result to a pandas DataFrame
top_10_songs_df = ____
print(top_10_songs_df)