replace blank space with nan

if we have a dataframe in which we havent NaN value in some specific space then how can we get the NaN value in blank space.

Could you please send me screen shot of problem??

yes sure

now i just want that the blank space is filled with nan values.

recently i do so but thats not a proper way to do.

so, i want to do it with the codes and in a proper way…

you can use

df = df.replace(r'^\s*$', np.nan, regex=True)

If you are exporting the data from the CSV file

df = pd.read_csv(file_csv, na_values=' ')

oks i’ll try it.

but, really i didn’t understand what is this, and how it’s work