识别错误-寻找建议

时间:2019-02-11 17:13:58

标签: python-3.x

我正在寻找建议,以解决此识别错误。 我不明白为什么要这样:

n_control_points = len(df_city_service)

`

complete_route_list = []
complete_route_list1 = []


n_control_points = len(df_city_service)
latitude = list(df_city_service["latitude"])
tripid_to_nodes = []
tripid_to_nodes_list = []
userid_to_nodes = []
userid_to_nodes_list = []

for uniquetripid in uniquetripid:
    df_city_service = df_city.loc[df_city["tripId"] == uniquetripid]
    userid = df_city_service.iloc[0]['userId']
    longitude = list(df_city_service["longitude"])

#creates the "data" variables, which contains lat and lon for  given tripid's control points
data = []
for latitude, longitude in zip(latitude,longitude):
    protodata = (latitude, longitude)
    data.append(protodata)

route_segment = []
route_segment1 = []
complete_route = []
complete_route1 = []

i = 0
#the while loop is responsible for generation of nodes list route from point i to point i+1
while i < (n_control_points-1):

    start_point = data[i]
    end_point = data[i+1]
    # get the nearest network node to each point
    orig_node = ox.get_nearest_node(G, start_point)
    int_node = ox.get_nearest_node(G, end_point)

    # find the route between these nodes.
    #I am stupidly calling it twice because I am not able to duplicate the
    #list and delete first item in one and last item in the other
    route_segment = nx.shortest_path(G, orig_node, int_node, weight='length')
    route_segment1 = nx.shortest_path(G, orig_node, int_node, weight='length')

    # two lists are needed to define edges
    route_segment.pop() #delete last item in u_nodes list
    route_segment1.pop(0) #delete first item in v_node list


    complete_route = complete_route + route_segment
    complete_route1 = complete_route1 + route_segment1
    tripid_to_nodes = [uniquetripid]*len(complete_route)
    userid_to_nodes = [userid]*len(complete_route)

    i = i + 1

# incremental storage of nodes list through tripIds
complete_route_list = complete_route_list + complete_route
complete_route_list1 = complete_route_list1 + complete_route1
#assignment of tripId and UserId values
tripid_to_nodes_list = tripid_to_nodes_list + tripid_to_nodes
userid_to_nodes_list = userid_to_nodes_list + userid_to_nodes
print("tripid processato:", uniquetripid)`

基本上在行上失败

文件“”,第8行      n_control_points = len(df_city_service)     ^ IndentationError:意外缩进

真的很欢迎任何帮助。

致谢。

0 个答案:

没有答案
相关问题