Skip to content

Latest commit

 

History

History
45 lines (31 loc) · 1.33 KB

README.md

File metadata and controls

45 lines (31 loc) · 1.33 KB

carto2gpd

Coverage Status t PyPi version Anaconda-Server Badge

A Python utility to query a CARTO database and return a geopandas GeoDataFrame.

Installation

Via conda:

conda install -c controllerphl carto2gpd

Via PyPi:

pip install carto2gpd

Example

import carto2gpd

url = "https://phl.carto.com/api/v2/sql"
where = "date_ > current_date - 30"
gdf = carto2gpd.get(url, "shootings", fields=['age', 'fatal'], where=where, limit=5)

gdf.head()

There is also a utility function to get the size of a CARTO database:

url = "https://phl.carto.com/api/v2/sql"
size = carto2gpd.get_size(url, "shootings")
size