Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

time_leap = 15*60 # In seconds

output = []
for path_year in path_years:
    for month in range(12):
        start_date, end_date, month_str = month_start_end_date(month, path_year[-4:])
        month_output = []
        for loc in location_id:
            print(type(loc))
        for plate in location_id:
            filename = ('Deliveries_for_delivery_points_on_' + month_str + '_' + path_year[-4:] + '.csv')
            month_input = pd.read_csv(filename, sep=';')
            print(np.shape(month_input))
            for i, timestamp in enumerate(month_input.iloc[:,0]):
                month_input.iloc[i,0] = int(datetime_to_dt_number(timestamp) / (time_leap))
            all_timestamps = np.arange(int((datetime_to_dt_number(start_date)-60*60*4)/time_leap),
                                       int((datetime_to_dt_number(end_date)-60*60*4)/time_leap))
            print(np.shape(month_input['ID klijenta']))
            print(np.shape(location_id))
            unloading_timestamps = np.where(month_input['ID klijenta'] == location_id,
                                            month_input['Vrijeme istovara'], 0)
            all_timestamps_2D = np.array([all_timestamps,]*np.shape(unloading_timestamps)[0]).transpose()
            unloading_timestamps_2D = np.array([unloading_timestamps,]*np.shape(all_timestamps)[0])
            unloading_timestamps_2D = np.where(all_timestamps_2D == unloading_timestamps_2D, 1, 0)
            unloading_timestamps = unloading_timestamps_2D.sum(axis=1)
            if month_output != []:
                month_output = np.concatenate((month_output, [unloading_timestamps]), axis=0)
            else:
                month_output = [unloading_timestamps]
        if output != []:
            output = np.concatenate((output, month_output), axis=1)
        else:
            output = np.copy(month_output)  
        print(np.shape(output))
        os.remove(filename)

Where is the error???

question from:https://stackoverflow.com/questions/65933075/valueerror-lengths-must-match-to-compare-635-12

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
368 views
Welcome To Ask or Share your Answers For Others

1 Answer

Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...