import seaborn as sns
import numpy as np
import matplotlib as mpl
from matplotlib import pyplot as plt
import pandas as pd
from datetime import datetime,timedelta
%matplotlib inline
plt.rcParams[‘font.sans-serif’]=[‘SimHei’] # 用来正常显示中文标签
plt.rcParams[‘axes.unicode_minus’]=False # 用来正常显示负号
from datetime import datetime
films=[‘穿过寒冬拥抱你’,‘反贪风暴5:最终章’,‘李茂扮太子’,‘误杀2’,‘以年为单位的恋爱’,‘黑客帝国:矩阵重启’,‘雄狮少年’,‘魔法满屋’,‘汪汪队立大功大电影’,‘爱情神话’]
regions=[‘中国’,‘英国’,‘澳大利亚’,‘美国’,‘美国’,‘中国’,‘英国’,‘澳大利亚’,‘美国’,‘美国’]
bos=[‘61,181’,‘44,303’,‘42,439’,‘22,984’,‘13,979’,‘61,181’,‘44,303’,‘41,439’,‘20,984’,‘19,979’]
persons=[‘31’,‘23’,‘56’,‘17’,‘9’,‘31’,‘23’,‘56’,‘17’,‘9’]
prices=[‘51’,‘43’,‘56’,‘57’,‘49’,‘51’,‘43’,‘56’,‘57’,‘49’]
showdate=[‘2022-12-03’,‘2022-12-05’,‘2022-12-01’,‘2022-12-02’,‘2022-11-05’,‘2022-12-03’,‘2022-12-05’,‘2022-12-01’,‘2022-12-02’,‘2022-11-05’]
ftypes=[‘剧情’,‘动作’,‘喜剧’,‘剧情’,‘剧情’,‘爱情’,‘动作’,‘动画’,‘动画’,‘动画’]
points=[‘8.1’,‘9.0’,‘7.9’,‘6.7’,‘3.8’,‘8.1’,‘9.0’,‘7.9’,‘6.7’,‘3.8’]
filmdescript={
‘ftypes’:ftypes,
‘bos’:bos,
‘prices’:prices,
‘persons’:persons,
‘regions’:regions,
‘showdate’:showdate,
‘points’:points
}
import numpy as np
import pandas as pd
cnbo2021top5=pd.DataFrame(filmdescript,index=films)
cnbo2021top5[[‘prices’,‘persons’]]=cnbo2021top5[[‘prices’,‘persons’]].astype(int)
cnbo2021top5[‘bos’]=cnbo2021top5[‘bos’].str.replace(‘,’,‘’).astype(int)
cnbo2021top5[‘showdate’]=cnbo2021top5[‘showdate’].astype(‘datetime64’)
cnbo2021top5[‘points’]=cnbo2021top5[‘points’].apply(lambda x:float(x) if x!=‘’ else 0)
cnbo2021top5
常用调色盘
r_hex = ‘#dc2624’ # red, RGB = 220,38,36
dt_hex = ‘#2b4750’ # dark teal, RGB = 43,71,80
tl_hex = ‘#45a0a2’ # teal, RGB = 69,160,162
r1_hex = ‘#e87a59’ # red, RGB = 232,122,89
tl1_hex = ‘#7dcaa9’ # teal, RGB = 125,202,169
g_hex = ‘#649E7D’ # green, RGB = 100,158,125
o_hex = ‘#dc8018’ # orange, RGB = 220,128,24
tn_hex = ‘#C89F91’ # tan, RGB = 200,159,145
g50_hex = ‘#6c6d6c’ # grey-50, RGB = 108,109,108
bg_hex = ‘#4f6268’ # blue grey, RGB = 79,98,104
g25_hex = ‘#c7cccf’ # grey-25, RGB = 199,204,207
color=[‘#dc2624’ ,‘#2b4750’,‘