1 of 26

Data-driven cartography for data scientists

Andy Eschbacher

Data Scientist

@MrEPhysics

2 of 26

About me

cartographer

3 of 26

About me

cartographer

software developer

4 of 26

About me

cartographer

software developer

data scientist

5 of 26

About me

cartographer

software developer

data scientist on CARTO's research team

6 of 26

7 of 26

  • File and map renaming death spiral
  • Redundant and out-of-date maps
  • Too much context switching: notebook disconnected from CARTO
  • Needed to quickly iterate on data and see it on a map

But we had a workflow problem

8 of 26

  • Make it work
  • Make it right
  • Make it fast

Let's fix it

Make great cartography

9 of 26

A programming language that...

  • Is easy-to-learn
  • Is powerful
  • You can do anything with… (really strong community)

Mostly in Python

10 of 26

Flexible medium for showing reproducible workflows involving data, code, text, and charts.

And Jupyter Notebooks

11 of 26

  • Easy to go from data to map
  • Lacks easy legends
  • Hard to balance large and small scale in static image
  • Not easily explorable

Plotting:

Geopandas

12 of 26

Plotting:

matplotlib

  • Very customizable
  • Notoriously hard
  • Lots of code for decent (basic) maps
  • Legends!

Source: Jake VanderPlas, Out-of-core DataFrames

13 of 26

Source: Jake VanderPlas, Out-of-core DataFrames

Plotting:

matplotlib

  • Very customizable
  • Notoriously hard
  • Lots of code for decent (basic) maps
  • Legends!

14 of 26

Plotting:

Folium

  • Interactive
  • Pretty basic
  • Legends

Source: Folium

15 of 26

Plotting:

GeoNotebook

  • Powerful and fast
  • Hard to set up
  • Too specific?
  • Not cloud-based

Source: Geonotebook GitHub

16 of 26

cartoframes

17 of 26

Goals of cartoframes

  • CARTO without leaving a notebook
  • Leverage Carto's services
  • Reproducible workflows with maps
  • Sensible and dynamic defaults
  • Easy

18 of 26

CARTO without leaving a notebook

  • Read: cc.read('nacis_pois')
  • Write: cc.write(df, 'nacis_2017')
  • Query: cc.query('big long arbitrary SQL')
  • Delete: cc.delete('nacis_2016')
  • Map! cc.map(layers=[list of layers])
  • More soon :)

19 of 26

Leverage CARTO's services

  • Animated maps are first class citizens
  • Location Data Services (somewhat) baked in
  • Cloud-based data storage
  • PostGIS database!
  • CartoColors
  • More coming

20 of 26

Reproducible workflows

with maps

21 of 26

Defaults

  • Our Voyager basemap as the default map
  • Basemap labels respond to geometry type
  • Marker outline responds to basemap
  • CartoColors everywhere

22 of 26

Since cartoframes returns matplotlib images, you can start composing them for comparison across different variables.

Programmatic

23 of 26

DEMO!

24 of 26

Legends

Legends are coming soon!

I think they're going to kill me.

But there's an open pull request.

25 of 26

Feedback

I'd love feedback!

  • Find me afterwards
  • Open GitHub issues
  • Ask me hard questions in a second :)

26 of 26

Thanks!

cartoframes source code + examples

https://github.com/cartodb/cartoframes/

Install

pip install cartoframes

Andy Eschbacher

Data Scientist

@MrEPhysics