CARTOframes

A Python package for integrating CARTO maps, analysis, and data services into data science workflows.

What is CARTOframes?

CARTOframes is a Python package for integrating CARTO maps, analysis, and data services into data science workflows.

Python data analysis workflows often rely on the pandas and jupyter notebook de facto standards. Integrating CARTO into this workflow saves data scientists time and energy by not having to export datasets as files or retain multiple copies of the data. To understand the fundamentals of CARTOframes, read the guides. To view the source code, browse the open-source repository in GitHub and contribute. Otherwise, read the full reference API, or find different support options.

Guides

Quick reference guides for learning how to use CARTOframes features.

Reference

Browse the interactive API documentation to search for specific CARTOframes methods, arguments, and sample code that can be used to build your applications.

Check Full Reference API
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from cartoframes.auth import Context
from cartoframes.viz import Map, Layer, Legend, Source
from cartoframes.data import Dataset
import pandas

context = Context(base_url='https://your_user_name.carto.com', api_key='your_api_key')

# Get the data
incident_reports_df = pandas.read_csv('https://data.sfgov.org/resource/wg3w-h783.csv')
incident_reports_df.head()

# Create a dataset
incident_reports_data = Dataset.from_dataframe(incident_reports_df)

# Visualize the data
Map(Layer(incident_reports_data))

# Upload it to your account
incident_reports_data.upload('nyc_incident_reports', context=context)

# Use built-in helper methods
from cartoframes.viz.helpers import color_category_layer

nyc_map = Map(
    color_category_layer(incident_reports_data, 'incident_day_of_week', 'Day of Week', top=7)
)

# Publish your visualization
nyc_map.publish('nyc_incident_reports')

Examples

Play with real examples and learn by doing.

1
2
3
## CARTOframes Examples

All the CARTOframes practical examples and use cases are placed in our [GitHub repository](https://github.com/CartoDB/cartoframes/blob/master/examples)

Support

Get help or learn about known issues.