Esempio n. 1
0
	'''
    LE = LabelEncoder()
    food_inspections['ViolLevel'] = food_inspections['ViolLevel'].fillna(0)
    food_inspections['ViolLevel'] = LE.fit_transform(
        food_inspections['ViolLevel'])

    return food_inspections


'''''' '''''' '''''' '''''' '''''' ''''''
' O B T A I N   Y E L P   D A T A  '
'''''' '''''' '''''' '''''' '''''' ''''''

#First check if we can scrape data from Yelp!
try:
    results = Yelp.search('food', 'Boston MA')
except:
    print "ERROR: Could not extract data from Yelp. Looks like Yelp was unable to authenticate you. Do you have the necessary authentication tokens and keys? Check Yelp.py for more information."
    sys.exit()

#Load data
food_inspections = pd.read_csv('fixed_locations.csv',
                               sep=',',
                               low_memory=False)
food_inspections = food_inspections.iloc[::-1]

#Convert the set {NaN,*,**,***} in ViolLevel to the set {0,1,2,3}
food_inspections = fixViolLevel(food_inspections)

#Drop the unnecessary columns
columns = [