Python csv write empty cell. Hence, the following line does it all: df = pd.