You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
824 B

from pyecharts.charts import Line
from pyecharts import options as opts
import pandas as pd
data = {
}
film=pd.read_csv('./dataCleanFile/film_all.csv')
film['上映时间']=film['上映时间'].str[0:10]
group_film=film.sort_values("上映时间").groupby("上映时间")["票房"].sum()
for i in zip(group_film.index,group_film):
data[i[0]]=i[1]
print(list(data.values()))
line=Line()
line.add_xaxis(list(data))
line.add_yaxis("票房(万)", list(data.values()))
line.set_global_opts(title_opts=opts.TitleOpts(title="近日热播电影每日票房",pos_left="right"),
yaxis_opts=opts.AxisOpts(name="票房(万)"),
xaxis_opts=opts.AxisOpts(name="日期",axislabel_opts=opts.LabelOpts(rotate=-90,interval=0,font_size=10)))
line.render("./visualizationFile/line_example.html")