Loading a CSV dataset

To load a dataset into the account using CARTOframes, we will use the pandas library again, which is installed with the Jupyter modules. Pandas allow us to read data from a CSV (and other file formats), loading it into a Pandas dataframe (a special data object that allows for a multitude of data-manipulation methods, as well as producing output). Then, using CartoContext, the dataframe is written (as a table) to the account:

import pandas as pd
APIKEY = "{YOUR API KEY}"
cc = cartoframes.CartoContext(base_url='https://{username}.carto.com/', api_key=APIKEY)
df = pd.read_csv(r'Path osacramento.csv')
cc.write(df, 'sacramento_addresses')

This will write the CSV table, imported as a dataframe, into the CARTO account DATASETS section:

The imported dataset will not be a geospatial table, but is instead a table that can be queried and joined to spatial data.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset