Skip to content
Advertisement

My while function is not returning any value ! What am i doing wrong

Quite newbie to this !

i have a dataframe that looks like this:

JavaScript

i have written that looks like this:

JavaScript

the expected output is :

JavaScript

When i run my function i dont have any result … I mean the flag is not working properly. All rows are set to None

What wrong here ?

Advertisement

Answer

Use numpy.select for this since apply is very inefficient:

JavaScript

[out]

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement