Published
- 1 min read
replace value column by another if missing pandas
The solution for this is noted below
replace value column by another if missing pandas
Solution
import numpy as np
df['column'] = np.where(df['column'].isnull(), 'value_if_true', 'value_if_false')
Try other methods by searching on the site. That is if this doesn’t work