Commit cd90dcfa authored by SHRADDHEYA SHENDRE's avatar SHRADDHEYA SHENDRE

Adding collab-filter.py after taking care of the fact that order of movies can be different

parent 54d15904
#!/usr/bin/python3
import csv
file = open('movie-ratings.csv')
readerObj = csv.reader(file)
data = list(readerObj)
userFile = open('user_preference.csv')
userObj = csv.reader(userFile)
temp = list(userObj)
def map( str ):
if str=="The Godfather":
return 1
elif str=="Pulp Fiction":
return 2
elif str=="Gone With the Wind":
return 3
elif str=="12 Angry Men":
return 4
elif str=="Lawrence of Arabia":
return 5
elif str=="Raging Bull":
return 6
elif str=="The Clockwork Orange":
return 7
elif str=="Cinema Paradiso":
return 8
elif str=="Wild Strawberries":
return 9
else:
return 10
userRatings = ["MyUser", -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]
for i in range(10):
userRatings[map(temp[0][i])] = temp[1][i]
data.append(userRatings)
file.close()
userFile.close()
print(data)
#data is complete at this point
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment