I want to replace the cells of column A with the value of column B, if the value of columns A is empty:
import pandas as pd
df = pd.DataFrame({'A':[1, 2, '', 4, ''], 'B':[6, 7, 8, 9, 10]})
Should return:
A B
1 6
2 7
8 8
4 9
10 10
I tried to replace the empty values of columns A but I got an
"Series.replace cannot use dict-value and " ValueError: Series.replace cannot use dict-value and non-None to_replace
df['A'] = df['A'].replace('', df['B'])
How can I replace the empty cells?