my dataframe contains 10000+ rows , 2 columns columns are y(val) and its pobability (in decimal) i have to apply formula:
=[0 if y_score < 0.5 else 1]
ypred=[0 if y_score < 0.5 else 1]
and Add column which will show either 0 or 1 as output corresponding to the value.
pls provide the syntax as i am new in python world.
I am trying to pass whole dataframe in calling function but not getting result.
def class_label(df):
if df['proba'] > 0.5:
df['Class'] == 1
else:
df['Class'] == 0 // function def
and
df['class'] = class_label(df) - calling function