最终展示
数据
实战
from pyecharts import options as opts
from pyecharts.charts import Bar
import pandas as pd
df = pd.read_excel("Top250.xls",index_col=False)
print(df.head())
# 电影类型图
from collections import Counter
colors = ' '.join([i for i in df[ '类型']]).strip().split()
c = dict(Counter(colors))
print(c)
d = c.pop('1978(中国大陆)')
list_items_key = []
list_items_values = []
for key,value in c.items():
list_items_key.append(key)
list_items_values.append(value)
bar = (
Bar()
.add_xaxis(list_items_key)
.add_yaxis("电影类型", list_items_values)
.set_global_opts(
title_opts=opts.TitleOpts(title="Top250 电影评分"),
datazoom_opts=opts.DataZoomOpts(),
)
.render("25.html")
)
如果学习上有遇到问题,加/:yiyi990805(备注:阿里云tony)即可。