Sample CSV file:
Year,Month
0, 1
5, 3
10,6
15, 4
code:
import csv
with open(‘Sampledata2Dplot.csv’, newline=”) as csvfile:
reader = list(csv.reader(csvfile))
print(reader)
I am getting the following output
Output:
[[‘Year’, ‘Month’], [‘0’, ‘1’], [‘5’, ‘3’], [’10’, ‘6’], [’15’, ‘4’]]
However, I need to read data to list as below
reader = [(“Year”, “Month”),(0, 1),(5, 3),(10, 6),(15, 4),]
OR
reader = [[‘Year’, ‘Month’],[0, 1],[5, 3],[10, 6],[15, 4],]
Finally my objective is to export this data to excel plotting with openpyxl.