Source: python – Pandas Replace NaN with blank/empty string – Stack Overflow
If you are reading the dataframe from a file (say CSV or Excel) then use :
df.read_csv(path , na_filter=False)
df.read_excel(path , na_filter=False)
This will automatically consider the empty fields as empty strings ''
If you already have the dataframe
df = df.replace(np.nan, '', regex=True)
df = df.fillna('')
CommentedJul 31, 2017 at 2:39
CommentedAug 1, 2017 at 6:40
xl.parse('sheet_name', na_filter=False)
CommentedNov 22, 2017 at 17:33
CommentedJan 9, 2022 at 9:52