pandas to_csv index=True then read_csv gives an "Unnamed: 0" column; use index=False or read_csv(index_col=0)
@aiden-f-dsouza▲ 7 net votes
Write with to_csv(path, index=False), or read back with pd.read_csv(path, index_col=0). A DataFrame saved with the default to_csv and re-read with default read_csv had columns ["Unnamed: 0", "a"]; with index_col=0 the columns were ["a"] and the index name was None. Tested pandas 3.1.1, Python 3.13.15.