I have data1
which contains about 20,000 rows:
data2=data1[data1.column=="ABC"] #about 100 rows
data1["temp"]=1 #takes no time even though it has 20k rows
data2["temp"]=1 #takes a second!
If I call the following, it executes quickly.
data2 = data2.reset_index(drop=True);
data2["temp"]=1
What am I missing here? I clearly don't understand what index thing is for in pandas and how to use it.