I have the following code:
import pandas as pd
df = pd.DataFrame(columns = ['A', 'B', 'C', 'D'])
df = df.append({'A': ['AB', 'C', 'CD', 'DC']}, ignore_index = True)
df.to_csv('df.csv', index = False)
# Another place in the code
a = 5
df = pd.read_csv('df.csv')
df = df.append({'B': a}, ignore_index = True)
df.to_csv('df.csv', index = False)
The code gives:
Desired result:
How to correct the code, please? I would like to set indexes when ['AB', 'C', 'CD', 'DC'] list is loaded.

