Answers for "how to save data to csv file python"

34

code how pandas save csv file

df.to_csv('out.csv')
Posted by: Guest on March-31-2020
0

python convert dat file to csv

import csv

with open("infile.dat") as infile, open("outfile.csv", "w") as outfile:
    csv_writer = csv.writer(outfile)
    prev = ''
    csv_writer.writerow(['ID', 'PARENT_ID'])
    for line in infile.read().splitlines():
        csv_writer.writerow([line, prev])
        prev = line
Posted by: Guest on June-25-2020
1

python save as csv

import numpy as np
np.savetxt('data.csv', (col1_array, col2_array, col3_array), delimiter=',')
Posted by: Guest on February-07-2020

Code answers related to "how to save data to csv file python"

Python Answers by Framework

Browse Popular Code Answers by Language