0

I have 4218 users id. What I want is to merge 4218 users information to the main data frame. I am using for loop ranging from 1 to 4218 but it crashes. But for loop works up to 1000. what is the problem?

Here is my code:

idi=list(merged["UserID"].unique())
len(idi)

for i in idi:
    userid_wise=merged[merged["UserID"]==i]
    users_answer_text=userid_wise[['AnswerText','QuestionID']]
    asked_question=pd.merge(asked_question,users_answer_text,how='left',on='QuestionID')
imtinan
  • 15
  • 5
  • Welcome to SO it is difficult to tell because we lack a [mcve]. Mainly, input, expected output, code you have tried and errors you are facing. Also notice than merge does not require explicit loop. – jlandercy Oct 19 '20 at 09:43
  • Does this answer your question? [Pandas - GroupBy and then Merge on original table](https://stackoverflow.com/questions/24980437/pandas-groupby-and-then-merge-on-original-table) and [efficient-way-to-merge-multiple-large-dataframes](https://stackoverflow.com/questions/50886269/efficient-way-to-merge-multiple-large-dataframes) – woblob Oct 19 '20 at 12:00

0 Answers0