Data Csv Dashboard Python
With help from this foro I can create my Optimizator dashboard. Now, I need to make some changes. This is the code: import csv import datetime with open('prueba.csv', 'rb') as f:
Solution 1:
The real names are in your_list[0]
. So change this line
print"item[%d]:" % (n+2,),
to this:
print your_list[0][n+2] + ":",
To save the output as a csv
, instead of (or as well as) printing your data out, you need to save it so that you can pass it to csv.writer
. Create a list called result
, and for every row that you want to see in the output, do
row = [name, datetime.datetime.strftime(day,"%d/%m/%Y"), mylist[0][n+2],value[1], value[0]]
result.append(row)
After you have finished building result
, sort it on name:
result.sort()
Use csv.writer()
to produce your csv
file from this list, one call to the writer object's writerow()
method for every row in result
.
Post a Comment for "Data Csv Dashboard Python"