Open 6287q opened 5 months ago
import shapely if line_intersection.is_empty: pass else:
if type(line_intersection) == shapely.geometry.linestring.LineString: arrive = [line_intersection] else: arrive = list(line_intersection)
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怎么解决
从中提取其中的到离站轨迹
import shapely if line_intersection.is_empty: pass else:
将每一次到站信息放入list中
构建为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怎么解决