美文网首页数据安全
Python可视化交互式饼图

Python可视化交互式饼图

作者: Benfrost | 来源:发表于2022-06-13 18:15 被阅读0次

    import pandas as pd

    import plotly.express as px

    data = pd.read_excel(r'D:\workbench\tensorflow\datavision\org.xlsx')

    data.head()

    #line_A代表人员规模 line_B代表产值

    fig = px.sunburst(data,path=["centre","department","team"],values="line_A",color="line_B",

                    color_continuous_scale = 'Rdbu')

    fig.show()

    运行,生成可交互式饼图,可以层层递进以便更好的展示效果。


    运行过程提示

    C:\Users\RL-068\anaconda3\lib\site-packages\plotly\express\_core.py:1637: FutureWarning:

    The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.

    C:\Users\RL-068\anaconda3\lib\site-packages\plotly\express\_core.py:1637: FutureWarning:

    The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.

    C:\Users\RL-068\anaconda3\lib\site-packages\plotly\express\_core.py:1637: FutureWarning:

    The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.

    相关文章

      网友评论

        本文标题:Python可视化交互式饼图

        本文链接:https://www.haomeiwen.com/subject/jkoomrtx.html