ST2Vec
ST2Vec copied to clipboard
Q dealing with NaN in map-matched vertex sequence
Hi there. Sorry to bother again. First of all, I would like to express my gratitude for sharing your amazing work and responding the previous questions! I am trying to understand the codes for map matching part so I added the following codes to STmatching_distribution_ver.py
. Hope it is correct by logic.
if __name__ == '__main__':
import pickle
import pandas
fr = open("data/tdrive/st_traj/tdrive.pkl",'rb')
trs = pickle.load(fr)
traj_df = pd.DataFrame([])
for col, values in trs.iterrows():
traj_i = pd.DataFrame(data=values['trajectory'], columns=['LON', 'LAT'])
traj_i['TRAJ_ID'] = values['id']
trajectory = values['trajectory']
traj_df = pd.concat([traj_df, traj_i], axis=0)
print("end")
traj_task_list = data_convert(traj_df)
mmtr_list = []
for traj in traj_task_list:
mmtr = trajectory_matching(traj)
mmtr_list.append(mmtr)
print(mmtr_list)
However, most matched vertex sequences in mmtr_list
contain some nan
vertices. Should I ignore nan
values or just eliminate those trajectories?
Also, Could you explain a little bit more about how to get the ultimate matching_result.csv
file? Maybe I'm missing something.
Thanks so much!
Zixin Qin BJTU