forked from CAVIND46016/Yelp-Dataset-Analysis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathyelp_fieldlists.py
27 lines (21 loc) · 1.22 KB
/
yelp_fieldlists.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
BUSINESS = "business"
REVIEW = "review"
TIP = "tip"
CHECKIN = "checkin"
USER = "user"
def getHeaders(_type):
if(_type == BUSINESS):
return ["name", "city", "review_count", "hours", "neighborhood", "categories", "latitude","stars","attributes","longitude","address","postal_code", "state", "is_open", "business_id", "type"];
elif (_type == REVIEW):
return ["review_id", "user_id", "date", "useful", "text", "cool", "stars", "business_id", "type", "funny"];
elif (_type == TIP):
return ["business_id", "user_id", "date", "text", "likes", "type"];
elif (_type == CHECKIN):
return ["business_id", "time", "type"];
else:
return ["user_id", "name", "review_count", "yelping_since", "friends", "useful", "funny", "cool", "fans", "elite", "average_stars", "compliment_hot", "compliment_more", "compliment_profile", "compliment_cute", "compliment_list", "compliment_note", "compliment_plain", "compliment_cool", "compliment_funny", "compliment_writer", "compliment_photos", "type"];
def getData(_type, _data):
data_arr = []
for i in getHeaders(_type):
data_arr.append(_data['{}'.format(i)])
return data_arr