You can install additional packages
!python3 -m pip install --upgrade pip \
--user --quiet --no-warn-script-location
!python3 -m pip install pygal \
--user --quiet --no-warn-script-location
And apply them
import pygal,pandas as pd
from IPython.display import SVG, display
from pygal.style import BlueStyle
columns=['Fresh','Milk','Grocery','Frozen',
'Detergents_Paper','Delicatessen']
colors=['#1b2c45','#5a8bbd','#008b8b','#ff5a8b']
index= ['C1','C2','C3']
data=[[26373,36423,22019,5154,4337,16523],
[16165,4230,7595,201,4003,57],
[14276,803,3045,485,100,518]]
samples=pd.DataFrame(data,columns=columns,index=index)
line=pygal.Line(
fill=False,height=int(400),width=int(900),
style=BlueStyle(
opacity='.3',colors=colors,background='transparent'))
line.title='Samples of the Wholesale Customers Dataset'
line.x_labels=columns
line.add('C1',data[0]); line.add('C2',data[1])
line.add('C3',data[2]); line.add('MEAN',samples.mean())
line.render_to_file('samples.svg')
display(SVG(open('samples.svg','rb').read()))
No comments:
Post a Comment