Multiple histograms in Pandas

后端 未结 5 1458
攒了一身酷
攒了一身酷 2020-12-05 06:59

I would like to create the following histogram (see image below) taken from the book \"Think Stats\". However, I cannot get them on the same plot. Each DataFrame takes its o

5条回答
  •  情话喂你
    2020-12-05 07:51

    From the pandas website (http://pandas.pydata.org/pandas-docs/stable/visualization.html#visualization-hist):

    df4 = pd.DataFrame({'a': np.random.randn(1000) + 1, 'b': np.random.randn(1000),
                        'c': np.random.randn(1000) - 1}, columns=['a', 'b', 'c'])
    
    plt.figure();
    
    df4.plot(kind='hist', alpha=0.5)
    

提交回复
热议问题