I have a dataframe with empty cells and would like to replace these empty cells with NaN. A solution previously proposed at this forum works, but only if the cell contains a space:
df.replace(r'\s+',np.nan,regex=True)
This code does not work when the cell is empty. Has anyone a suggestion for a panda code to replace empty cells.