This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from sklearn.metrics import confusion_matrix | |
| from sklearn.metrics import classification_report | |
| import matplotlib.pyplot as plt | |
| %matplotlib inline | |
| import numpy as np | |
| """ | |
| Use your classification model to predict some labels | |
| Then, plot confusion matrix and classification report using below code | |
| y_test: real labels | |
| y_pred: predicted model labels |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| import requests | |
| import json | |
| addres_list = list(McDonalds_data['address']) #prepare variable to pass to URL | |
| state_list = list(McDonalds_data['state']) #prepare variable to pass to URL | |
| placesAPI_data = pd.DataFrame(columns=['formatted_address', 'name', 'permanently_closed']) #initialize dataframe | |
| for i in range(len(addres_list)): | |
| address = addres_list[i].replace(' ', '%20') #make sure there are no blank spaces for the URL | |
| state = state_list[i] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from bs4 import BeautifulSoup | |
| import urllib.request | |
| import pandas as pd | |
| import time | |
| import random | |
| scrapping_list = web_scrapping_list[0:2000] #this is your list of zip codes | |
| alldata = pd.DataFrame(columns=['name', 'address', 'city', 'zipcode']) #initialize dataframe | |
| for j, zipi in enumerate(scrapping_list): | |
| url = "https://www.menuism.com/search?q=McDonald%27s&l=" + zipi + "&p=0&s=match&pp=25&f=0" |