In [1]:
from pandas import read_csv
from geopandas import GeoDataFrame, points_from_xy
remote_file_path = 'http://data.sfgov.org/resource/wg3w-h783.csv'
df = read_csv(remote_file_path)
# Clean rows where the `longitude` column is NULL
df = df[df['longitude'].notna()]
gdf = GeoDataFrame(df, geometry=points_from_xy(df['longitude'], df['latitude']))
gdf.head()
Out[1]:
In [2]:
from cartoframes.viz import Layer
Layer(gdf)
Out[2]:
In [3]:
from cartoframes.utils import decode_geometry
remote_file_path='http://libs.cartocdn.com/cartoframes/files/starbucks_brooklyn_geocoded.csv'
df = read_csv(remote_file_path)
gdf = GeoDataFrame(df, geometry=decode_geometry(df['the_geom']))
gdf.head()
Out[3]:
In [4]:
Layer(gdf)
Out[4]: