'Missing geocoding parametr

This is my dataframe view

from cartoframes.data.services import Geocoding

gc = Geocoding()

london_stations_gdf, london_stations_metadata = gc.geocode(
        df,
        street='Borough',
        city={'value': 'London'},
        country={'value': 'United Kingdom'}
    )

ValueError: Credentials attribute is required. Please pass a Credentials instance or use the set_default_credentials function.

Error relate with Geocoding parametrs. however use gc = Geocoding(credentials=None), return me same error.



Solution 1:[1]

Assuming you have creds (username and api_key)

If you need to create the creds.json file, run the following

from cartoframes.auth import Credentials

Credentials('my_username', 'my_api_key').save('creds.json')

then modify your code to set your default credentials

from cartoframes.auth import set_default_credentials
from cartoframes.data.services import Geocoding

# set your default creds
set_default_credentials('path/to/your/creds.json')

gc = Geocoding()

london_stations_gdf, london_stations_metadata = gc.geocode(
        df,
        street='Borough',
        city={'value': 'London'},
        country={'value': 'United Kingdom'}
    )

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Bob Haffner