1

I have a dataframe df that I read from a .csv file that contains some missing values:

import pandas as pd
df = pd.read_csv('my_file.csv')

df:
    Name       Age   Civil
0   Leonard    30    Engaged
1   Sheldon    31   
2   Howard           Married
3   Raj        29    Single

If I check the missing values in my Notebook it returns empty string, where

df['Civil'][1]:
'            '

type(df['Civil'][1]):
str

How can I replace empty string with NaN?

emax
  • 6,965
  • 19
  • 74
  • 141
  • In particular, see [this answer](https://stackoverflow.com/a/47810911/9209546) in the marked dup. – jpp Oct 17 '18 at 12:58

0 Answers0