I have a Dataframe1 that is with a length of 4000, and I have a list with a length of 600.
I want to compare the list with a column from the Dataframe1 and if they have the same value I want to move the row of the Dataframe1 to Dataframe2 and if not I want to move it to Dataframe3
so this was my code but it takes forever to run, can anyone recommend a faster solution.
for i in range(len(Dataframe1)):
for j in range(len(list)):
if Dataframe1['Column'][i] == list[j]:
Datafram2 = Dataframe2.append(Dataframe1.loc[[i]])
else:
Datafram3 = Dataframe3.append(Dataframe1.loc[[i]])