Faster way to subtract columns and update row values?
Faster way to subtract columns and update row values?
colSet1 = list(range(20))
colSet2 = list(range(21,40))
colSet3 = list(range(41,60))
for col1 in colSet1:
for col2 in colSet2:
for col3 in colSet3:
df[col1+col2+col3+"_newcol"] = df[col1+col2+col3]-df[col1]
I tried rsub but it seems to give wrong results, not sure, if i implemented it correctly. What is the correct way to use rsub in this case, If that is the fastest way?