I have data frame like as following:
id date t_s t_p t_prob
1 '2020-01-01' 1 1 0.5
1 '2020-01-01' 2 1 0.55
1 '2020-01-01' 3 1 0.56
1 '2020-01-01' 4 0 0.4
1 '2020-01-01' 5 1 0.6
1 '2020-01-01' 6 1 0.7
2 '2020-01-01' 1 1 0.77
2 '2020-01-01' 2 0 0.3
2 '2020-01-01' 3 0 0.2
2 '2020-01-01' 4 0 0.33
2 '2020-01-01' 5 1 0.66
2 '2020-01-01' 6 1 0.56
....
each id has same date for example (2020-01-01-2020-01-09). each id has 6 t_s(1,2,3,4,5,6) for each date, and t_p is the label for each t_s, and t_prob is the value of label fo each t_s. I want to get transform the t_prob value for each t_s in the same date to the columns like t_s_1, t_s_2, t_s_3, t_s_4, t_s_5, t_s_6. and Finally get the most value of t_prob, and t_s value. like id 1 in '2020-01-01' is t_s_6 is the most value.
id date t_s_1 t_s_2 t_s_3 t_s_4 t_s_5 t_s_6 t_prob_max_s
1 '2020-01-01' 0.5 0.55 0.56 0.4 0.6 0.7 6
2 '2020-01-01' 0.77 0.3 0.2 0.33 0.66 0.56 1
....
Thanks!
groupby, I've done this before, but I can't do it now.t_svalues for each date per unique id present in sequential order i.e from1to6?unstackcan do the same.