I have a sample of the dataframe as given below.
data = {'Participant':['A', 'B', 'C', 'D'],
'Total Entry':[2, 3, 1, 3],
'Time':[['2021-07-12', '2021-07-16'],['2021-07-21','2021-07-22','2021-07-24'],['2021-06-20'],['2021-07-26','2021-07-29','2021-08-01']],
'Values':[['Negative','Negative'],['Positive','Positive','Negative'],['Negative'],['Negative','Positive','Negative']]}
df_test= pd.DataFrame(data)
df_test
I want to unpack corresponding values of 2 columns and append it to the corresponding rows. The final obtained result is shown below.
I tried using pop, unstack and Series functions, but it is not working. Any help is greatly appreciated. Thanks.
Try:
df_test.explode(['Time', 'Values'])