dtoolkit.geoaccessor.series.geocode#
- dtoolkit.geoaccessor.series.geocode(s: Series, /, drop: bool = False, **kwargs) GeoDataFrame[source]#
Geocode string type Series and get a GeoDataFrame of the resulting points.
- Parameters
- dropbool, default False
Don’t contain the original data anymore.
- **kwargs
See the documentation for
geocode()for complete details on the keyword arguments.
- Returns
- GeoDataFrame
- Raises
- ModuleNotFoundError
If don’t have module named ‘geopy’.
- ValueError
If ‘drop’ is True and the name of Series is empty.
Examples
>>> import dtoolkit.geoaccessor >>> import pandas as pd >>> s = pd.Series( ... [ ... "boston, ma", ... "1600 pennsylvania ave. washington, dc", ... ], ... ) >>> s 0 boston, ma 1 1600 pennsylvania ave. washington, dc dtype: object >>> s.geocode(drop=True) geometry address 0 POINT (-71.06051 42.35543) Boston, Massachusetts, United States 1 POINT (-77.03655 38.89770) White House, 1600, Pennsylvania Avenue Northwe...