I have a CSV file that only has column headers:
cat mycsv.csv
col_1@@@col_2@@@col_3@@@col_3
I have to fill a single row with None
values in each cell of the CSV file. Can someone suggest me the best-optimized way to do that in Python and Pandas?
After I fill the row the csv file should look like:
cat mycsv.csv
col_1 , col_2 , col_3 , col_3
0@@@None@@@None@@@None
How to insert index and separator is @@@
instead of ,
? I am getting an error as:
tmp.to_csv(csvFile,sep='@@@',index=True)
, line 1381, in to_csv
formatter.save()
3.6.1/linux_x86_64/lib/python3.6/site-packages/pandas/formats/format.py", line 1473, in save
self.writer = csv.writer(f, **writer_kwargs)
TypeError: "delimiter" must be a 1-character string
Exception ignored in: <module 'threading' from Traceback (most recent call last):
File python-3.6.1/linux_x86_64/lib/python3.6/threading.py", line 1015, in
_delete
del _active[get_ident()]
KeyError: 140459817715712
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…