Explore your data

Visualize your local data (even without a CARTO account) or hosted datasets straight out of Jupyter notebooks.

from cartoframes.viz import Map, Layer
from cartoframes.viz.helpers import size_continuous_layer
import geopandas as gpd

# Download the dataset arlington_bikeshare_july_agg.geojson in 
# https://github.com/CartoDB/cartoframes-landing-page-example
arlington_bikeshare_july_file = 'arlington_bikeshare_july_agg.geojson'
Map(size_continuous_layer(arlington_bikeshare_july_file,
                          'total_events',
                          'Pickups + Drop Offs'))
cartoframes interactive visualizations

Enrich your data

Access a wide range of datasets from around the globe—all on standardized spatial aggregations to reduce your time to insight.

Location Data Streams
from cartoframes.auth import set_default_credentials, Credentials
from cartoframes.client import DataObsClient
from cartoframes.data import Dataset
from cartoframes.viz.helpers import color_continuous_layer

# Log in to CARTO 
creds = Credentials('your_username', 'your_api_key')
set_default_credentials(creds)

# Filter out Arlington
do = DataObsClient(creds)
arlington_ct = do.boundaries(region=[-77.17232, 38.827447, -77.032086, 38.93428],
                             boundary='us.census.tiger.census_tract', decode_geom=True)
arlington_df = arlington_ct.dataframe[arlington_ct.dataframe.geom_refs.str.startswith('51013')]

Dataset(arlington_df).upload(table_name='arlington_ct', credentials=creds, if_exists='replace')

# Augmenting it with % of no car households
do.augment('arlington_ct',
           [{"numer_id": "us.census.acs.B08201002", "denom_id": "us.census.acs.B11001001",
             "normalization": "denominated", "geom_id": 'us.census.tiger.census_tract' }],
           how='geom_refs', persist_as='arlington_ct_no_cars')
Map(color_continuous_layer('arlington_ct_no_cars', 'no_cars_2011_2015_by_households', 'No Car Households'))
cartoframes data enrichment

Analyze your data

Get insights from your data using our API and interact with CARTO using your own libraries, functions, and workflows.

from libpysal.weights import Queen
from pysal.explore.esda.moran import Moran_Local
from cartoframes.viz.helpers import color_category_layer

gdf = gpd.GeoDataFrame(Dataset('arlington_ct_no_cars').download(decode_geom=True))
wq = Queen.from_dataframe(gdf)
wq.transform = 'r'
li = Moran_Local(gdf['no_cars_2011_2015_by_households'], wq)
sig = 1 * (li.p_sim < 0.05)
spot_qs = [1, 3, 2, 4] # HH(hotspot), LL(coldspot), LH(doughnut), HL(diamond)
spots = sum([i * (sig * li.q==i) for i in spot_qs])

spot_labels = ['Not significant', 'Hot spot', 'Low outlier', 'Cold spot', 'Hot outlier']
labels = [spot_labels[i] for i in spots]
hmap = ['#E4E4E4','#1785FB', '#F24440', '#12A2B8']
Map([color_category_layer(gdf.assign(cl=labels), 'cl', title='Spot', palette=hmap),
     size_continuous_layer(arlington_bikeshare_july_file, 'total_events', 'Pickups + Drop Offs')])
cartoframes Analyze data

Upload and share your maps

Once your analysis is done, add some pre-defined widgets and share the results—empowering business teams to act straight away.

# Send results to carto
Dataset(gdf.assign(cl=labels)).upload(table_name='arlington_ct_no_cars', credentials=creds, if_exists='replace')
Dataset(arlington_bikeshare_july_file).upload(table_name='bikeshare_july_agg', credentials=creds, if_exists='replace')
outmap = Map([
    color_category_layer('arlington_ct_no_cars', 'cl', title='Spot', palette=hmap, widget=True),
    size_continuous_layer('bikeshare_july_agg', 'total_events', 'Pickups + Drop Offs', widget=True)
])
publication = outmap.publish('arlington_hot_spots_study')
print(publication['url'])
outmap
cartoframes Upload map
  • Explore your data

    Visualize your local data (even without a CARTO account) or hosted datasets straight out of Jupyter notebooks.

  • Enrich your data

    Access a wide range of datasets from around the globe—all on standardized spatial aggregations to reduce your time to insight.

    Location Data Streams
  • Analyze your data

    Get insights from your data using our API and interact with CARTO using your own libraries, functions, and workflows.

  • Upload and share your maps

    Once your analysis is done, add some pre-defined widgets and share the results—empowering business teams to act straight away.