I am trying to create a barchart showing off the price of spotify premium from different countries around europe. I do not know how to import a csv file to create this graph. this is my current code
import pygal as pg
import csv
filename = 'premiumusersEurope.csv'
with open(filename) as f:
reader = csv.reader(f)
#print(list(reader))
pg_bar = pg.Bar()
for row in reader:
x.append(int(row[0]))
y.append(int(row[1]))
pg_bar.render_to_file("simple.svg")
This code is not working, and i cannot find out why.
This is my data any help will be appriciated
Hope this may help :
or
or
or please refer this link : https://realpython.com/python-csv/