Question: print( -== Examples (first three playlists) ) pprint(artist_itemsets[:31) Exercise 5: get_artist_counts (1 point) For the Notebook 2 analysis, we also needed a way to count

 print(" -== Examples (first three playlists) ) pprint(artist_itemsets[:31) Exercise 5: get_artist_counts

print(" -== Examples (first three playlists) ) pprint(artist_itemsets[:31) Exercise 5: get_artist_counts (1 point) For the Notebook 2 analysis, we also needed a way to count in how many receipts each item occurred. That's your next task Given a collection of artist itemsets, complete the function get_artist_counts(itensets) so that it returns a dictionary-like object with artist names as keys and the number of occurrences as values For example, suppose you start with these three itemsets. itensets - Calicia Keys, Saya', 'lucio battisti', 'the police'), (u', 'the police'), ('jay 31 Then get_artist_counts(itensets) should return: (alicia Keys": 1, "jay t': 2, 'lucio battista' 1, the police, 1) Note: By dictionary.like," we moon either a conventional Python dictionary or a collections.defaultdiet, as prefer Hint: Recall update_iten.counts from Notebook 2 which we ve provided again in the code cell below In [398]: def update itencounts(item_counts, itenset: for in Stenset item count() def get_artist_count(tensets): www - YOUR COOL HERE Fincipython-input-58-16715226 Syntaxror unexpected or while parsing in 1 w Demo cele Itensets te wys. wylocie batti 'the police'), ('u the police'), ( ) get_artist_counts(itsets) In Test cell_artist,counts' (point) we AUTOGRADER YEST DO NOT REMOVE

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!