In [3]:
%matplotlib inline
import pandas as pd
import geopandas
from shapely.geometry import Point, Polygon
pd.options.display.max_rows = 10
In [1]:
# xsv partition transport_mode data BATO_GTFS.csv
In [8]:
stops = pd.read_csv("data/BATO_bus.csv")
stops['geometry'] = stops.apply(lambda z: Point(z.longitude, z.latitude), axis=1)
stops = geopandas.GeoDataFrame(stops)
stops
Out[8]:
In [9]:
dptm = geopandas.read_file("data/departements-20140306-5m.shp")
dptm.dropna(inplace=True)
In [10]:
stops = geopandas.sjoin(stops, dptm[['nom', 'geometry']].copy(), op='within')
stops.head()
Out[10]:
In [11]:
stops.to_csv("data/BATO_by_regions.csv")
In [ ]:
#xsv partition --filename BATO_{}.csv nom . BATO_by_regions.csv