I'm saving my csv without errors with pandas but I have a problem on my columns name, there is a "," that I want to remove !
import pandas as pd
csv_path = "your\csv\path\and\filename.csv"
df = pd.DataFrame(data={'filename': [], 'words': []})
df.to_csv(path_or_buf=csv_path,index=False)
I have ,filename,words
but I just want filename,words
CodePudding user response:
You're code is right for Pandas 1.3.4:
# df = pd.DataFrame(data={'filename': [], 'words': []})
>>> print(df.to_csv())
,filename,words
>>> print(df.to_csv(index=False))
filename,words