dataset={ \'future hendrix\': {\'Lady in the Water\': 2.5, \'Snakes on a Plane\'
ID: 3940845 • Letter: D
Question
dataset={
'future hendrix': {'Lady in the Water': 2.5,
'Snakes on a Plane': 3.5,
'Just My Luck': 3.0,
'Superman Returns': 3.5,
'You, Me and Dupree': 2.5,
'The Night Listener': 3.0},
'remya kannan': {'Lady in the Water': 3.0,
'Snakes on a Plane': 3.5,
'Just My Luck': 1.5,
'Superman Returns': 5.0,
'The Night Listener': 3.0,
'You, Me and Dupree': 3.5},
'george nakleh': {'Lady in the Water': 2.5,
'Snakes on a Plane': 3.0,
'Superman Returns': 3.5,
'The Night Listener': 4.0},
'akin laniyan': {'Snakes on a Plane': 3.5,
'Just My Luck': 3.0,
'The Night Listener': 4.5,
'Superman Returns': 4.0,
'You, Me and Dupree': 2.5},
'andrea carlos': {'Lady in the Water': 3.0,
'Snakes on a Plane': 4.0,
'Just My Luck': 2.0,
'Superman Returns': 3.0,
'The Night Listener': 3.0,
'You, Me and Dupree': 2.0},
'migos quavo': {'Lady in the Water': 3.0,
'Snakes on a Plane': 4.0,
'The Night Listener': 3.0,
'Superman Returns': 5.0,
'You, Me and Dupree': 3.5},
'Toby': {'Snakes on a Plane':4.5,
'You, Me and Dupree':1.0,
'Superman Returns':4.0},
'attang':{}}
concerning the dataset how do you convert that into a excel sheet where the key is the row and value is the column where the inside value is values of the rows and columns code in python 3.5
Explanation / Answer
Answer:
Note: dataSet is already provided in the Question
Python code:
#Returning the distance from first person to the second one
def MakeCalculation(prefss, persons1, persons2):
#Getting the shared list Item
sis = {}
for items in prefss[persons1]:
if items in prefss[persons2]:
sis[items] = 1
# there is no common rating which returns zero
if len(sis) == 0:
return 0
# Adding the squared SUM
sum_of_squaresVal = sum([
pow(prefss[persons1][items] - prefss[persons2][items], 2)
for items in prefss[persons1] if items in prefss[persons2]])
return 1 / (1 + sum_of_squaresVal)
'future hendrix': {'Lady in the Water': 2.5,
'Snakes on a Plane': 3.5,
'Just My Luck': 3.0,
'Superman Returns': 3.5,
'You, Me and Dupree': 2.5,
'The Night Listener': 3.0},
'remya kannan': {'Lady in the Water': 3.0,
'Snakes on a Plane': 3.5,
'Just My Luck': 1.5,
'Superman Returns': 5.0,
'The Night Listener': 3.0,
'You, Me and Dupree': 3.5},
'george nakleh': {'Lady in the Water': 2.5,
'Snakes on a Plane': 3.0,
'Superman Returns': 3.5,
'The Night Listener': 4.0},
'akin laniyan': {'Snakes on a Plane': 3.5,
'Just My Luck': 3.0,
'The Night Listener': 4.5,
'Superman Returns': 4.0,
'You, Me and Dupree': 2.5},
'andrea carlos': {'Lady in the Water': 3.0,
'Snakes on a Plane': 4.0,
'Just My Luck': 2.0,
'Superman Returns': 3.0,
'The Night Listener': 3.0,
'You, Me and Dupree': 2.0},
'migos quavo': {'Lady in the Water': 3.0,
'Snakes on a Plane': 4.0,
'The Night Listener': 3.0,
'Superman Returns': 5.0,
'You, Me and Dupree': 3.5},
'Toby': {'Snakes on a Plane':4.5,
'You, Me and Dupree':1.0,
'Superman Returns':4.0},
'attang':{}}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.