Reputation: 507
How do I append another list to the column df_final['time_seq'] which is stored in timeseq=[xyz,xyz...,xyz]
Upvotes: 0
Views: 48
Reputation: 1344
For your particular question:
additional_time_seq = [1234567, 1234568]
# i the index of the row you want
# the line below gives you the time_seq list
time_seq_to_append = df_final.loc[df_final.index[i], 'time_seq']
# the line below extends the time_seq list with the additional_time_seq
time_seq_to_append.extend(additional_time_seq)
Generally, df.loc[df.index[i], 'NAME']
gives you the element for a named column with integer indices, and since that's a list in your case, you can use the built-in extends method for Python lists.
Upvotes: 2