Hi guys I am new to python and I need some solution or hint what alternative can be used . I am trying to create a new column based on existing column of python for some 77k records.
I already tried a solution but this below piece of code is taking 25 mins to do so.
can anyone please help me how to do in some 1 or 2 mins. I do same step in SAS in 30 secs. i need in python
def dataset(df row):
if df row[‘Past_ID’] in (‘AAA’, ’ ‘):
df_row[ ‘Current_ID’] = "TEST’
Else
df_row[‘Current_ID’] = df_row[‘Past_ID’]
if df row[‘Past_ID’] in (BBB’, ’ ‘):
df_row[ ‘Current_ID’] = "TEST’
if df row[‘Past_ID’] in (CCC’, ’ ‘):
df_row[ ‘Current_ID’] = "TEST’
return df_row
dataset = dataset, apply(testifconn, axis=1)
dataset
