使用pyecharts 绘制常用四种图表柱状图
折线图
散点图
饼图
import pandas as pd
df= pd.read_excel('服装销售.xlsx')
df
from pyecharts import options as opts
from pyecharts.charts import Bar
from pyecharts.globals import ThemeType
bar=(
Bar(init_opts=opts.InitOpts(theme=ThemeType.LIGHT))
.add_xaxis(df['商品'].to_list())
.add_yaxis('商家A',df['商家A'].to_list())
.add_yaxis('商家B',df['商家B'].to_list())
.set_global_opts(title_opts=opts.TitleOpts(
title='商品销售对比图',subtitle="柱状图"))
)
bar.render_notebook()
from pyecharts import options as opts
from pyecharts.charts import Line
from pyecharts.globals import ThemeType
line=(
Line(init_opts=opts.InitOpts(theme=Them