|
""" |
|
Cannabis Licenses | License Mao |
|
Copyright (c) 2022 Cannlytics |
|
|
|
Authors: |
|
Keegan Skeate <https://github.com/keeganskeate> |
|
Candace O'Sullivan-Sutherland <https://github.com/candy-o> |
|
Created: 9/22/2022 |
|
Updated: 9/30/2022 |
|
License: <https://github.com/cannlytics/cannabis-data-science/blob/main/LICENSE> |
|
|
|
Description: |
|
|
|
Map the adult-use cannabis retailers permitted in the United States: |
|
|
|
- Alaska |
|
- Arizona |
|
β California |
|
- Colorado |
|
- Connecticut |
|
- Illinois |
|
β Maine |
|
- Massachusetts |
|
- Michigan |
|
- Montana |
|
β Nevada |
|
β New Jersey |
|
- New Mexico |
|
- New York |
|
β Oregon |
|
- Rhode Island |
|
- Vermont |
|
β Washington |
|
|
|
""" |
|
|
|
import os |
|
|
|
|
|
import folium |
|
import pandas as pd |
|
|
|
|
|
|
|
DATA_DIR = '../data' |
|
DATA_FILES = { |
|
'ca': 'ca/licenses-ca-2022-09-21T19-02-29.xlsx', |
|
'me': 'me/licenses-me-2022-09-30T16-44-03.xlsx', |
|
'nj': 'nj/licenses-nj-2022-09-29T16-17-38.xlsx', |
|
'nv': 'nv/retailers-nv-2022-09-30T07-41-59.xlsx', |
|
'or': 'or/licenses-or-2022-09-28T10-11-12.xlsx', |
|
'wa': 'wa/licenses-wa-2022-09-29T14-44-25.xlsx', |
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
data = [] |
|
for state, data_file in DATA_FILES.items(): |
|
filename = os.path.join(DATA_DIR, DATA_FILES[state]) |
|
licenses = pd.read_excel(filename, index_col=0) |
|
data.append(licenses) |
|
|
|
|
|
retailers = pd.concat(data) |
|
retailers = retailers.loc[ |
|
(~retailers['premise_longitude'].isnull()) & |
|
(~retailers['premise_latitude'].isnull()) |
|
] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
locations = retailers[['premise_latitude', 'premise_longitude']].to_numpy() |
|
m = folium.Map( |
|
location=[39.8283, -98.5795], |
|
zoom_start=3, |
|
control_scale=True, |
|
) |
|
for index, row in retailers.iterrows(): |
|
folium.Circle( |
|
radius=5, |
|
location=[row['premise_latitude'], row['premise_longitude']], |
|
color='crimson', |
|
).add_to(m) |
|
m.save('../analysis/figures/cannabis-licenses-map.html') |
|
|