0

enter image description here

How do I append another list to the column df_final['time_seq'] which is stored in timeseq=[xyz,xyz...,xyz]

Iguananaut
  • 19,186
  • 4
  • 48
  • 59
Rasika
  • 325
  • 5
  • 18

1 Answers1

2

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.

brunston
  • 1,027
  • 8
  • 15