I used cloudSim and CloudReports simulators for an experiment and i got my results into a raw data file rawData.CRD
. Now I want to convert it to a csv file so that I can import it into RStudio for further analysis.
I followed this script.
import csv
import itertools
with open('rawData.CRD', 'r') as in_file:
stripped = (line.strip() for line in in_file)
lines = (line for line in stripped if line)
grouped = itertools.izip(*[lines] * 3)
with open('extracted.csv', 'w') as out_file:
writer = csv.writer(out_file)
writer.writerow(('title', 'intro', 'tagline'))
writer.writerows(grouped)
It is creating a .csv file with all single row. But I want each values in seperate cells (when opened in Excel).
This is how my input raw file looks like from the simulator.
and this is what I get after applying the script, all data as single element.
Please Help me to modify the script.