I have this code which replaces all spaces/gaps within my data structure with NaN:
replace_spaces = data.replace(r\'^\\s*$\', np.nan, regex=True)