I am working on a huge dataframe
and trying to create a new column, based on a condition in another column. Right now, I have a big while-loop
and this calculation takes too much time, is there an easier way to do it?
With lambda
for example?:
def promo(dataframe, a):
i=0
while i < len(dataframe)-1:
i=i+1
if dataframe.iloc[i-1,5] >= a:
dataframe.iloc[i-1,6] = 1
else:
dataframe.iloc[i-1,6] = 0
return dataframe