-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathTopCusinies.py
158 lines (149 loc) · 4.9 KB
/
TopCusinies.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
import pandas as pd
import matplotlib as plt
import matplotlib.pyplot as plt
import math
import numpy as np
from collections import Counter
from collections import defaultdict
giza = pd.read_csv(r'G:\Fourth Year\GP\RecommendationModel\restaurants data\restaurants_giza.csv')
alex = pd.read_csv(r'G:\Fourth Year\GP\RecommendationModel\restaurants data\restaurants_data_alex2.csv')
sharm = pd.read_csv(r'G:\Fourth Year\GP\RecommendationModel\restaurants data\restaurants_data_sharm.csv')
luxor = pd .read_csv(r'G:\Fourth Year\GP\RecommendationModel\restaurants data\Luxor.csv')
cairo = pd .read_csv(r'G:\Fourth Year\GP\RecommendationModel\restaurants data\Cairo_Final.csv')
Alfayyum = pd .read_csv(r'G:\Fourth Year\GP\RecommendationModel\restaurants data\Alfayyum.csv')
Hurghada = pd .read_csv(r'G:\Fourth Year\GP\RecommendationModel\restaurants data\Hurghada.csv')
hash_map=dict()
for cusinie in giza['cuisines']:
try:
if cusinie != 'None':
words = cusinie.split(", ")
# print(words)
for word in words:
# print(word)
if word in hash_map:
hash_map[word]+=1
else:
hash_map[word]=1
# if hash_map[word] == None:
# hash_map[word] = 1
# else:
# hash_map[word] = hash_map[word] + 1
except:
ctr=0
# print("error")
for cusinie in alex['cuisines']:
try:
if cusinie != 'None':
words = cusinie.split(", ")
# print(words)
for word in words:
# print(word)
if word in hash_map:
hash_map[word]+=1
else:
hash_map[word]=1
# if hash_map[word] == None:
# hash_map[word] = 1
# else:
# hash_map[word] = hash_map[word] + 1
except:
ctr=0
# print("error")
for cusinie in sharm['cuisines']:
try:
if cusinie != 'None':
words = cusinie.split(", ")
# print(words)
for word in words:
# print(word)
if word in hash_map:
hash_map[word]+=1
else:
hash_map[word]=1
# if hash_map[word] == None:
# hash_map[word] = 1
# else:
# hash_map[word] = hash_map[word] + 1
except:
ctr=0
# print("error")
for cusinie in luxor['cuisines']:
try:
if cusinie != 'None':
words = cusinie.split(", ")
# print(words)
for word in words:
# print(word)
if word in hash_map:
hash_map[word]+=1
else:
hash_map[word]=1
# if hash_map[word] == None:
# hash_map[word] = 1
# else:
# hash_map[word] = hash_map[word] + 1
except:
ctr=0
# print("error")
for cusinie in cairo['cuisines']:
try:
if cusinie != 'None':
words = cusinie.split(", ")
# print(words)
for word in words:
# print(word)
if word in hash_map:
hash_map[word]+=1
else:
hash_map[word]=1
# if hash_map[word] == None:
# hash_map[word] = 1
# else:
# hash_map[word] = hash_map[word] + 1
except:
ctr=0
# print("error")
for cusinie in Alfayyum['cuisines']:
try:
if cusinie != 'None':
words = cusinie.split(", ")
# print(words)
for word in words:
# print(word)
if word in hash_map:
hash_map[word]+=1
else:
hash_map[word]=1
# if hash_map[word] == None:
# hash_map[word] = 1
# else:
# hash_map[word] = hash_map[word] + 1
except:
ctr=0
# print("error")
for cusinie in Hurghada['cuisines']:
try:
if cusinie != 'None':
words = cusinie.split(", ")
# print(words)
for word in words:
# print(word)
if word in hash_map:
hash_map[word]+=1
else:
hash_map[word]=1
# if hash_map[word] == None:
# hash_map[word] = 1
# else:
# hash_map[word] = hash_map[word] + 1
except:
ctr=0
# print("error")
# print(hash_map)
# for x,value in hash_map.items():
# print(x,value)
# print(x.value)
# print("Sorted")
# print(sorted(hash_map))
sorted_dict = dict(sorted(hash_map.items(), key=lambda item: item[1], reverse=True))
print(sorted_dict)