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
?