Hi everyone, I wrote this chunk of code. It seems to work to me, but I’m not extremely sure of its logic and I would appreciate if you could take a look and tell me if I make some mistake in the form or in the logic itself.
Screen Link:
My Code:
Replace this line with your code
```## convert the values into bool by creating a function
def update_vals(value):
if value == pd.isnull(value):
return np.nan
elif value == '-':
return False
else:
return True
## apply the function to the cols
tafe_diss_factors = ['Contributing Factors. Job Dissatisfaction',
'Contributing Factors. Dissatisfaction']
tafe_resignations[tafe_diss_factors].applymap(update_vals)
## assign the boolean into a new column
tafe_resignations_up = tafe_resignations.copy()
tafe_resignations_up['dissatisfied'] = tafe_resignations[tafe_diss_factors].applymap(update_vals).any(axis=1,skipna=False)
What I expected to happen:
What actually happened:
Replace this line with the output/error