I have a dataframe containing tweets that looks like this :
What I am trying to do is take the text from the rows where the column 'in_reply_to_user_id'(not in the picture because the df is too wide to fit) has the same value as a given id and append the text to a list which i then want to put in a new column. As an example, the text from all the tweets where the column 'in_reply_to_user_id' is equal to the 'id' of the first tweet should be put in a list that is then appended to a new column in the dataframe called 'replies'. Here are some of the things i tried :
for i in testb['in_reply_to_user_id']:
for j in test['user.id']:
if i == j:
index=testb.index()
test['replies'].append(testb['text'].iloc[index]) ```
test would be the original dataframe and testb would be a copy that i created in order to try to run the code above. it is just a copy of test.