Skip to content

NameError: name 'values' is not defined #16

Open
@pdatascientist

Description

@pdatascientist

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())

NameError

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions