This example illustrates how to read data from a CARTO table.
Use this when you need to see or modify the data locally. If you only need to visualize the data, just use the name of the dataset in the Layer:
Layer('dataset_name')
Note: You'll need CARTO Account credentials to reproduce this example.
from cartoframes.auth import set_default_credentials
set_default_credentials('cartoframes')
from cartoframes import read_carto
gdf = read_carto('starbucks_brooklyn')
gdf.head()
cartodb_id | the_geom | field_1 | name | address | revenue | |
---|---|---|---|---|---|---|
0 | 1 | POINT (-73.95901 40.67109) | 0 | Franklin Ave & Eastern Pkwy | 341 Eastern Pkwy,Brooklyn, NY 11238 | 1321040.772 |
1 | 2 | POINT (-73.96122 40.57796) | 1 | 607 Brighton Beach Ave | 607 Brighton Beach Avenue,Brooklyn, NY 11235 | 1268080.418 |
2 | 3 | POINT (-73.98976 40.61912) | 2 | 65th St & 18th Ave | 6423 18th Avenue,Brooklyn, NY 11204 | 1248133.699 |
3 | 4 | POINT (-74.02744 40.63152) | 3 | Bay Ridge Pkwy & 3rd Ave | 7419 3rd Avenue,Brooklyn, NY 11209 | 1185702.676 |
4 | 5 | POINT (-74.00098 40.59321) | 4 | Caesar's Bay Shopping Center | 8973 Bay Parkway,Brooklyn, NY 11214 | 1148427.411 |
from cartoframes.viz import Layer
Layer(gdf)