def recursiveIDidentifier(i, df):
for j in range(len(df)):
if df.iloc[j,i] == 0:
# print('Zeile: ',row[0],'ist null in Column: ', row[i])
recursiveIDidentifier(i-1, df)
return
else:
df.loc[j,'id'] = df.iloc[j,i]
i = 8
print('Gefunden')
return
i=8
recursiveIDidentifier(i, df)
0 4035 100834 0 0 0 0 0 0 0
1 4035 100834 100704 0 0 0 0 0 0
2 4035 100834 100943 0 0 0 0 0 0
3 4035 100834 100843 0 0 0 0 0 0
4 4035 100834 100841 0 0 0 0 0 0
Hey there. I am trying to find the Id which is not zero and write it into the last column which is not shown here. There might be a little mistake with finishing each run of the recursion before going to the next row. Any ideas? I tried different things with return and so on. But if i use return to finish each call of the recursion, i will finish the whole loop already in the first row.