我有以下要构造的数据框
id,x,y,time
我的输入数据就是这样 每帧:
point_lists = defaultdict(list)
id= id.astype(np.int32)
point_lists[id].append(center_pt.T)
saved_x = [i[0] for i in point_lists[id]]
saved_y = [i[1] for i in point_lists[id]]
x = list(map(lambda dd: float(dd[0]),saved_x))
y = list(map(lambda dd: float(dd[0]),saved_y))
现在我想把巴拿马作为
ID1, List of it's X, List of it's Y, FrameIDX
ID2, List of it's X, List of it's Y, FrameIDX
ID3, List of it's X, List of it's Y, FrameIDX
我无法将X列表和Y列表并入数据帧的问题。 我正在对中心(x,y)进行视频处理,我不知道如何保留ID->那时是x的列表,当时是y的列表以及帧IDx。
预期的Panadas数据框示例
,trajectory_id,frame,x ,y ,t ,s ,v ,side,is_primary,s_centered ,s_normalized ,is_crossing,is_long,is_close,is_valid
0 ,1 ,1 ,-2.0,-2.0,0.0,0.0 , ,1 ,True ,-3.6587033144922905,0.0 ,True ,True ,True ,True
1 ,1 ,2 ,0.1 ,-1.5,1.0,2.1587033144922905 ,2.1587033144922905 ,1 ,True ,-1.5 ,0.30304431375902774,True ,True ,True ,True
2 ,1 ,3 ,0.1 ,0.0 ,2.0,3.6587033144922905 ,1.5 ,1 ,True ,0.0 ,0.5136181650089165 ,True ,True ,True ,True
3 ,1 ,4 ,0.1 ,1.5 ,3.0,5.158703314492291 ,1.5 ,-1 ,True ,1.5000000000000004 ,0.7241920162588055 ,True ,True ,True ,True
4 ,1 ,5 ,2.0 ,2.0 ,4.0,7.123391584931141 ,1.96468827043885 ,-1 ,True ,3.46468827043885 ,1.0 ,True ,True ,True ,True
5 ,2 ,2 ,-2.0,2.0 ,0.0,0.0 , ,-1 ,False ,-1.9646882704388506,0.0 ,True ,True ,True ,True
6 ,2 ,3 ,-0.1,1.5 ,1.0,1.9646882704388506 ,1.96468827043885 ,-1 ,False ,0.0 ,0.27580798374119475,True ,True ,True ,True
7 ,2 ,4 ,-0.1,0.0 ,2.0,3.4646882704388506 ,1.5 ,1 ,False ,1.5 ,0.4863818349910837 ,True ,True ,True ,True
8 ,2 ,5 ,-0.1,-1.5,3.0,4.964688270438849 ,1.5 ,1 ,False ,2.9999999999999982 ,0.6969556862409724 ,True ,True ,True ,True
9 ,2 ,6 ,2.0 ,-2.0,4.0,7.123391584931138 ,2.1587033144922905 ,1 ,False ,5.158703314492287 ,1.0 ,True