I have a pandas dataFrame with two columns that looks like the following:
d1 = {'Time1': [[93, 109, 187],[159],[94, 96, 154, 169]],
'Time2':[[16, 48, 66, 128],[123, 136],[40,177,192]]}
df = pd.DataFrame(d1)
I need to split these columns of lists into 4 columns named 1st_half_T1, 2nd_half_T1, 1st_half_T2 and 2nd_half_T2 using pandas. The condition is, Time1 splits into 1st_half if Time <= 96 and 2nd_half if Time > 96 and applying the same condition to Time2 gives the following output.
1st_half_T1 2nd_half_T1 1st_half_T2 2nd_half_T2
0 [93] [109, 187] [16, 48, 66] [128]
1 [] [159] [] [123, 126]
2 [94, 96] [154, 169] [40] [177, 192]