python漏斗图的绘制

it2023-07-14  66

话不多说,上代码

In [10]: from pyecharts import Funnel ...: import pandas as pd ...: data = pd .read_csv('d:/cs/taobao/data1.csv',index_col =0) ...: attr1=data.index.tolist() ...: attrv=data["percent_conversion"].tolist() ...: funnel1=Funnel("总体通过率",width=800,height=400,title_pos="center") ...: funnel1.add(name="用户行为转化率", ...: attr=attr1, ...: value=attrv, ...: is_label_show=True, ...: label_formatter="{c}%", ...: label_pos="inside", ...: legend_orient="vertical", ...: legend_pos="left") ...: funnel1.render('d:/taobao/mychart.html') In [11]: data Out[11]: user_id item_id item_category date-time time percent_conversion behavior_type 1 985133 985133 985133 985133 985133 1.00 2 23179 23179 23179 23179 23179 0.02 3 29992 29992 29992 29992 29992 0.03 4 10271 10271 10271 10271 10271 0.01

 

 

最新回复(0)