Chrome Extension

Pandas DataFrame to CSV

# Use custom separator	sep	
df.to_csv('file_name.csv',sep='\t')
# Write without index	index	
df.to_csv('file_name.csv',index=False)
# Write without headers	header	
df.to_csv('file_name.csv',header=False)
# Write subset of columns	columns	
df.to_csv('file_name.csv',columns=['col_A','col_B'])
# Change file encoding format	encoding	
df.to_csv('file_name.csv',encoding='utf-8')
# Change NaNs as Unknown	na_rep	
df.to_csv('file_name.csv',na_rep='Unknown')
Best JSON Validator, JSON Tree Viewer, JSON Beautifier at same place. Check how cool is the tool
Was this helpful?
0 Comments
Join Devsheet Ask a Question