Accessing a dataset

To access the NBA arenas dataset that we loaded into the account, we are going to use the CartoContext read method, passing the name of the dataset we want to interact with as a string. In a Jupyter Notebook In section, run the following code:

import cartoframesAPIKEY = "{YOUR API KEY}"cc = cartoframes.CartoContext(base_url='https://{username}.carto.com/', api_key=APIKEY)df = cc.read('arenas_nba')print(df)

Using CartoContext, the account is accessed. With the cc object, the read method creates a DataFrame object from the NBA arenas dataset. The DataFrame object is what is queried or updated.

The print statement will produce a table with values from the NBA arenas dataset, which has been loaded into a CARTOframe object: ...

Get Mastering Geospatial Analysis with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.