epsilon-machine / missingpy

Missing Data Imputation for Python
GNU General Public License v3.0
240 stars 65 forks source link

NameError: name 'values' is not defined #16

Open pdatascientist opened 5 years ago

pdatascientist commented 5 years ago

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