In [6]:
from cartoframes.auth import set_default_credentials
set_default_credentials('creds.json')
In [9]:
from cartoframes.data.observatory import Enrichment
from cartoframes.data.services import Geocoding, Isolines
import pandas as pd
stores_df = pd.read_csv('http://libs.cartocdn.com/cartoframes/files/starbucks_brooklyn.csv')
stores_gdf, _ = Geocoding().geocode(stores_df, street='address')
aoi_gdf, _ = Isolines().isochrones(stores_gdf, [15*60], mode='walk')
aoi_enriched_gdf = Enrichment().enrich_polygons(aoi_gdf, ['total_pop_3cf008b3'])
In [11]:
from cartoframes.viz import Map, Layer, color_continuous_style, size_continuous_style
result_map = Map([
Layer(aoi_enriched_gdf, color_continuous_style('total_pop', stroke_width=0, opacity=0.7)),
Layer(stores_gdf, size_continuous_style('revenue', stroke_color='white'), default_widget=True)
])
result_map
Out[11]:
In [12]:
result_map.publish('onboarding_analysis', password=None, if_exists='replace')
Out[12]: