How to plot two DataFrame on same graph for comparison

前端 未结 2 1511
陌清茗
陌清茗 2021-02-10 03:21

I have two DataFrames (trail1 and trail2) with the following columns: Genre, City, and Number Sold. Now I want to create a bar graph of both data sets for a side by side compari

2条回答
  •  灰色年华
    2021-02-10 04:06

    You're one the right track, but you want merge rather than concat. Try this:

    DF = pd.merge(df1,df2,on=['Genre','City'])
    DF.Groupby([['Genre','City']]).sum().unstack().plot(kind = 'bar')
    

提交回复
热议问题