I am working on a project to determine if a patient will benefit from a specific type of implant.
I import my functions from a seperate .py file.
One of the functions creates a new column (named: yes_no) with assign. This works oke.
def yes_no(df):
return df.assign(yes_no=[0 if x < 8 else 1 for x in df['Q_score_diff']])
Now I want to add another condition in the function above, so the yes_no result will still be 0 or 1 in that new yes_no column.
The extra condition is that the values in df.other_column must be greater then 38. I can't figure it out. Can this be done in the same list comprehension? Thanks for the suggestion/help!! Cheers Jan