Skip to content

Commit 5792cd5

Browse files
authored
Update doc/python/lines-on-maps.md
1 parent b1d458b commit 5792cd5

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

doc/python/lines-on-maps.md

+9-3
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,15 @@ fig.add_trace(go.Scattergeo(
147147
flight_paths = []
148148
lons = []
149149
lats = []
150-
for i in range(len(df_flight_paths)):
151-
lons += [df_flight_paths['start_lon'][i], df_flight_paths['end_lon'][i], None]
152-
lats += [df_flight_paths['start_lat'][i], df_flight_paths['end_lat'][i], None]
150+
import numpy as np
151+
lons = np.empty(3 * len(df_flight_paths))
152+
lons[::3] = df_flight_paths['start_lon']
153+
lons[1::3] = df_flight_paths['end_lon']
154+
lons[::3] = None
155+
lats = np.empty(3 * len(df_flight_paths))
156+
lats[::3] = df_flight_paths['start_lat']
157+
lats[1::3] = df_flight_paths['end_lat']
158+
lats[::3] = None
153159

154160
fig.add_trace(
155161
go.Scattergeo(

0 commit comments

Comments
 (0)