I have a Series such as follow:
example = pd.Series([[1.0, 1209.75, 1207.25],
[1.0, 1211.0, 1207.5],
[-1.0, 1211.25, 1205.75],
[0, 1207.25, 1206.0],
[1.0, 1206.25, 1201.0],
[-1.0, 1205.75, 1202.75],
[0, 1205.5, 1203.75]])
This Series has basically a list of 3 numbers in each cell. I turn it into a DataFrame and add a new column:
example = example.to_frame(name="input")
example["result"]=np.NaN
Now i would like to perform the following operation on it:
example["result"] = example["input"].apply(lambda x,y,z: y if x==1 else z if x==-1 else NaN)
I receive the following error message when trying to do it:
missing 2 required positional arguments: 'y' and 'z'