Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 16478

How to create stacked barchart using pygal

$
0
0

I would like to create line chart using Pygal.The output should have 3 lines - 1 line for each category against the year.I have this error message: "NameError: name 'x' is not defined"

import pygal as pgimport pandas as pdimport csvimport numpyfilename = 'data.csv'with open(filename, 'r') 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")

Sample of the data is shown as below.data

Can someone advise where I have done wrongly?


Viewing all articles
Browse latest Browse all 16478

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>