Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

create or append dataframe to csv python

import os

# if file does not exist write header 
if not os.path.isfile('filename.csv'):
   df.to_csv('filename.csv', header='column_names')
else: # else it exists so append without writing the header
   df.to_csv('filename.csv', mode='a', header=False)
 
PREVIOUS NEXT
Tagged: #create #append #dataframe #csv #python
ADD COMMENT
Topic
Name
7+5 =