Take the 2-minute tour ×


A = D[D.label == k]

B = D[D.label != k]

then I change the label in A and B:

A.label = 1

B.label = -1


share|improve this question
its easier to get high quality answers if you accept correct ones ... –  Joran Beasley Oct 12 '12 at 0:06
add comment

1 Answer

up vote 7 down vote accepted

I believe you can use the append

bigdata=data1.append(data2,ignore_index = True)


share|improve this answer
This works. It creates a new DataFrame though. Is there a way to do it inline? That would be nice for when I'm loading huge amounts of data from a database in batches so I could iteratively update the DataFrame without creating a copy each time. –  Andrew Nov 5 '13 at 17:36
add comment

Your Answer


