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.
Quick reference guides for learning how to use CARTOframes features.
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 APIPlay with real examples and learn by doing.
Source: https://data.london.gov.uk/dataset/london-underground-performance-reports
import pandas
from cartoframes.auth import set_default_credentials
from cartoframes.data.services import Geocoding
set_default_credentials('creds.json')
file_path = 'https://libs.cartocdn.com/cartoframes/samples/london_stations.xls'
df = pandas.read_excel(file_path, header=6, sheet_name=1)
df.head()
df = df.rename(columns={
"Saturday.1": "saturday_exit",
"Sunday.1": "sunday_exit",
"Weekday.1": "weekday_exit",
"Saturday": "saturday_entry",
"Sunday": "sunday_entry",
"Weekday": "weekday_entry"
})
df.head()
gc = Geocoding()
london_stations_gdf, london_stations_metadata = gc.geocode(
df,
street='Borough',
city={'value': 'London'},
country={'value': 'United Kingdom'}
)
london_stations_gdf.head()
from cartoframes.viz import Map, Layer
Map(Layer(london_stations_gdf), viewport={'zoom': 10, 'lat': 51.53, 'lng': -0.09})
Get help or learn about known issues.