CartoDB / cartoframes

CARTO Python package for data scientists
BSD 3-Clause "New" or "Revised" License
251 stars 63 forks source link

fix geocoding status with cached parameter #1717

Closed simon-contreras-deel closed 3 years ago

simon-contreras-deel commented 3 years ago

Having a table with geocoding saved results, if you use some columns in status (which exist in the table) with cached=True, the columns added in status are not used (and also, columns are removed)

Example:

Geocoding saving results in a table

gdf, meta = gc.geocode(
    metros_df, 
    street='street',
    city='city',
    state='state',
    country={'value': 'USA'},
    status={'gc_all': '*', 'gc_relevance': 'relevance', 'gc_precision': 'precision'},
    table_name='geocoding_test',
    if_exists="replace"
)

If you want to do a new geocoding based on the saved results:

gdf2, meta2 = gc.geocode(
    metros_df, 
    street='street',
    city='city',
    state='state',
    country={'value': 'USA'},
    status={'gc_all': '*', 'gc_relevance': 'relevance', 'gc_precision': 'precision'},
    table_name='geocoding_test',
    cached=True
)

the columns gc_all, gc_relevance and gc_precision are not returned, and also, the columns are removed from the table geocoding_test