In [ ]:
from cartoframes.utils import set_log_level
set_log_level('debug')
In [ ]:
import geopandas as gpd
from cartoframes.auth import set_default_credentials
set_default_credentials()
In [ ]:
import pandas
df = pandas.read_csv('../files/ags.geography_usa_blockgroup_2015.csv')
In [ ]:
df.head(3)
In [ ]:
df = df[['geoid','geom']]
In [ ]:
df.head(3)
In [ ]:
from cartoframes.data.observatory import Dataset, Variable
dataset = Dataset.get('carto-do-public-data.usa_acs.demographics_sociodemographics_usa_blockgroup_2015_5yrs_20132017')
In [ ]:
dvs = dataset.variables
In [ ]:
for variable in dvs:
print(variable.agg_method, variable.db_type, variable.slug)
In [ ]:
variables = []
for i in range(10):
variables.append(dvs[i])
variables
In [ ]:
from cartoframes.data.observatory import Enrichment
enrichment = Enrichment()
enriched_dataset_cdf = enrichment.enrich_polygons(
df,
geom_col='geom',
variables=variables
)
In [ ]:
enriched_dataset_cdf.head(10)