I have a DataFrame with two columns ( A
and B
), in the column a
there are rows that are empty (can be "nan"
or " "
) How can I do to take the values of the column B
and pass them to the A
but only filling in the values that are empty or are null ?. For example:
import pandas as pd
import numpy as np
iDf2= {'a': [' ', 'juan', 'nan'],
'b': ['2', '5', 'martina']}
iDf2 = pd.DataFrame(iDf2)
I want it to stay like this:
iDf2= {'a': ['2','juan','martina'],
'b': ['2','5','martina']}