简体   繁体   中英

Basic bar plot using matplotlib

I've created a very basic dataframe, but as I'm a newbie I'm struggling with creating a bar plot using the matplotlib.pyplot library.

Here is the dataframe:

d = {'Movies' : pd.Series([3560, 12354], index = ['Netflix', 'Prime Video']),
     'Shows' : pd.Series([1925, 2132], index = ['Netflix', 'Prime Video'])
    }

df = pd.DataFrame(d)
df

Is it possible to have 'Streaming Service' on the x-axis (ie Netflix and Prime Video) and 'Number' on the y-axis (with different coloured bars for movies vs shows)?

This is as simple as df.plot.bar() :

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM