Let's take as an example with this simple dataset:
example_set = pd.DataFrame(data = {"dirr":[1,0,-1,-1,1,-1,0],
"value": [125,130,80,8,150,251,18],
"result":[np.NaN for _ in range(7)]})
The following line returns error:invalid syntax
example_set["result"].apply(lambda x : example_set["value"]if x["dirr"]==1)
Can anyone tell me what I am doing wrong?
Please do not come up with solution of how to do it without lambda: This is only a super simplified example that I made up to isolate my problem.
.apply(lambda x : example_set["value"] if x["dirr"]==1 else x)?TypeError: 'float' object is not subscriptable