这是一个解决方案
from shapely.geometry import Point, LineString o = [Point (-116.2847753565571, 43.61722615312507), Point(-116.2847753565571, 43.61722615312507), Point (-116.2847753565571,43.61722615312507)] d = [Point (-116.3042144501943, 43.60844476082184), Point(-116.3042144501943,43.60844476082184), Point(-116.3042144501943,43.60844476082184)] df = pd.DataFrame({'orig_coord' : o, 'dest_coord': d}) df['line']=df.apply(lambda x: LineString([x['orig_coord'], x['dest_coord']),axis=1) print(df['line'])
我已经用它来获取Point对象,但我没有想过要重复这个过程:
df['line']=[LineString(xy) for xy in zip(df.orig_coord,df.dest_coord)]