Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- data['days_employed'] = data['days_employed'].apply(abs)
- days_employed_med = data.groupby(['education','income_type'], as_index = False)['days_employed'].median()
- for index, row in days_employed_med.iterrows():
- education = row['education']
- income = row['income_type']
- data.loc[(data['days_employed'].isnull()) & (data['education'] == education) & (data['income_type'] == income), 'days_employed'] = days_employed_med[(days_employed_med['education'] == education) & (days_employed_med['income_type'] == income)]['days_employed']
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement