ni1o1 / transbigdata

A Python package develop for transportation spatio-temporal big data processing, analysis and visualization.
https://transbigdata.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
455 stars 115 forks source link

'MultiLineString #93

Open 6287q opened 5 months ago

6287q commented 5 months ago

从中提取其中的到离站轨迹

import shapely if line_intersection.is_empty: pass else:

将每一次到站信息放入list中

if type(line_intersection) == shapely.geometry.linestring.LineString:
    arrive = [line_intersection]
else:
    arrive = list(line_intersection)

构建为DataFrame

arrive = pd.DataFrame(arrive)

取每一次到离站时间

arrive['arrivetime']= arrive[0].apply(lambda r:r.coords[0][0]) arrive['leavetime']= arrive[0].apply(lambda r:r.coords[-1][0]) arrive

出现错误:'MultiLineString' object is not iterable怎么解决