Guided project step 7- df.any()

The output has false still… and I used df.copy() to avoid warning, but it still shows, why?

Thank you!

Screen Link: https://app.dataquest.io/m/348/guided-project%3A-clean-and-analyze-employee-exit-surveys/7/identify-dissatisfied-employees

My Code:

def update_vals(val):
    if pd.isnull(val):
        return np.NaN
    elif val == '-':
        return False
    else:
        return True
dete_col=['job_dissatisfaction',
'dissatisfaction_with_the_department',
'physical_work_environment',
'lack_of_recognition',
'lack_of_job_security',
'work_location',
'employment_conditions',
'work_life_balance',
'workload',]   
dete_resignations['dissatisfied']=dete_resignations[dete_col].applymap(update_vals).any(axis=1,skipna=False)

tafe_col=['contributing_factors._dissatisfaction','contributing_factors._job_dissatisfaction']  
tafe_resignations['dissatisfied']=tafe_resignations[tafe_col].applymap(update_vals).any(axis=1,skipna=False)
dete_resignations_up=dete_resignations.copy()
tafe_resignations_up=tafe_resignations.copy()

What I expected to happen:
Only Ture shows up.

What actually happened:

3      False
4      False
5      False
6      False
7      False
8      False
9      False
10     False
13     False
14      True
15     False
16       NaN
17      True
18       NaN

Hi @candiceliu93

Actually that’s the output you want. The idea of that function is to transform certain values, like empty entries into NaN, and the value ‘-’ into False.

Good luck!