I imported csv file as a list in python:
csv file:
2012,3,22
2012,3,30
2012,4,4
2012,4,7
2012,3,22
2012,3,22
2012,3,27
2012,3,30
2012,3,30
2012,4,7
code:
import csv
with open('file.csv', 'rb') as f:
reader = csv.reader(f)
date_list = list(reader)
print date_list
the output is:
[['2012', '3', '22'], ['2012', '3', '27'], ['2012', '3', '30'], ['2012', '3', '30'], ['2012', '4', '7']]
Now I want to plot it with matplotlib. my code is here but I do not know to apply my data into the code to generate the bar chart
I need just Year and month from the data. as you can see it in example
To get your monthly counts into the format you need for the stacked bar chart from your previous question
You could convert and extract as follows: