I have the following data frame that I want to construct like it
id,x,y,time
My input data is like that each frame:
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))
Now I want panadas as
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
The problem I can't concatent the List of X and List of Y into the dataframe. I'm doing a video processing of centers ( x,y) and I don't have an idea of how to keep ID --> List of it's x, List of it's y and the frame idx at that time.
Sample of expected Panadas Dataframe
,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