You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am getting NameError:name 'values' is not defined when executing the below code
Method to print the top 3 counts of user and songs data
def findTopCounts(list):
# Sort the rdd with play count as sorting key
sortedUserCounts = sorted(list, key = lambda x:x[1], reverse = True)
# Print the top 3 rows
for i in range(3):
print ("User "+str(sortedUserCounts[i][0])+" has a total play count of "+str(sortedUserCounts[i][1])
+" and a mean play count of "+str(sortedUserCounts[i][1]/sortedUserCounts[i][2])+".")
I am getting NameError:name 'values' is not defined when executing the below code
Method to print the top 3 counts of user and songs data
def findTopCounts(list):
# Sort the rdd with play count as sorting key
sortedUserCounts = sorted(list, key = lambda x:x[1], reverse = True)
# Print the top 3 rows
for i in range(3):
print ("User "+str(sortedUserCounts[i][0])+" has a total play count of "+str(sortedUserCounts[i][1])
+" and a mean play count of "+str(sortedUserCounts[i][1]/sortedUserCounts[i][2])+".")
findTopCounts(userArtistData.map(lambda x:(x[0],x[2])).groupByKey().map(lambda Column, values : Column, sum(values), len(values)).collect())
The text was updated successfully, but these errors were encountered: