Grouped Bar graph Pandas

前端 未结 2 1695
忘掉有多难
忘掉有多难 2020-12-03 14:08

I have a table in a pandas DataFrame named df:

+--- -----+------------+-------------+----------+------------+-----------+
|avg_view         


        
2条回答
  •  一个人的身影
    2020-12-03 14:57

    You should not have to modify your dataframe just to plot it in a certain way right ?

    Use seaborn !

    import seaborn as sns
    
    
    sns.catplot(x = "x",       # x variable name
                y = "y",       # y variable name
                hue = "type",  # group variable name
                data = df,     # dataframe to plot
                kind = "bar")
    

    source

提交回复
热议问题