cartoframes.utils module

cartoframes.utils.cssify(css_dict)
cartoframes.utils.dict_items(d)
cartoframes.utils.importify_params(param_arg)

Convert parameter arguments to what CARTO’s Import API expects

cartoframes.utils.join_url(*parts)

join parts of URL into complete url

cartoframes.utils.minify_sql(lines)

eliminate whitespace in sql queries

cartoframes.utils.norm_colname(colname)

Given an arbitrary column name, translate to a SQL-normalized column name a la CARTO’s Import API will translate to

Examples
  • ‘Field: 2’ -> ‘field_2’
  • ‘2 Items’ -> ‘_2_items’
Parameters:colname (str) – Column name that will be SQL normalized
Returns:SQL-normalized column name
Return type:str
cartoframes.utils.normalize_colnames(columns)

SQL-normalize columns in dataframe to reflect changes made through CARTO’s SQL API.

Parameters:columns (list of str) – List of column names
Returns:Normalized column names
Return type:list of str
cartoframes.utils.pgquote(string)

single-quotes a string if not None, else returns null

cartoframes.utils.unique_colname(suggested, existing)

Given a suggested column name and a list of existing names, returns a name that is not present at existing by prepending _ characters.