pygal

Create PyGal graph from pandas dataframe

回眸只為那壹抹淺笑 提交于 2019-12-05 22:29:16
I wanted to try using pygal with it's ability to create SVG data as i'm going to create a printed PDF page from the merged HTML with the SVG graph. What i want to do is the equivalent of pygal.plot(dataframe) but i'm not seeing that in the docs. I know that i can do: df = pd.Series(np.random.randn(5), index = ['a', 'b', 'c', 'd', 'e']) chart = pygal.Line() for index, row in df.iteritems(): chart.add(index,row) But that seems wrong from a python point of view. Should i be doing it differently? Plus how would i do this if the dataframe had multiple columns? You are using the pygal API the wrong

Pygal Maps World Not Working

情到浓时终转凉″ 提交于 2019-12-04 13:23:36
I am trying to create a simple program so as to display the map of central America with their population using Pygal_maps_world.Here's the code for the same import pygal_maps_world as pa wm=pa.World() wm.title="Map of Central America" wm.add('North America',{'cd': 84949494949,'mx': 494794164,'us': 99794616}) wm.render_to_file('map.svg') I have tried a few combinations regarding the importing of the World maps to work properly but to no avail and i am not able to create the visualization. Help me solve this query of mine Thanks In the recent versions of pygal, you start with the first four