This example illustrates how to upload local data to a CARTO account.
Note: You'll need CARTO Account credentials to reproduce this example.
from cartoframes.auth import set_default_credentials
set_default_credentials('creds.json')
from cartoframes import read_carto
gdf = read_carto("SELECT * FROM starbucks_brooklyn WHERE revenue > 1200000")
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 |
from cartoframes import to_carto
to_carto(gdf, 'starbucks_brooklyn_filtered', if_exists='replace')
Success! Data uploaded to table "starbucks_brooklyn_filtered" correctly
'starbucks_brooklyn_filtered'