I would like to plot histogram with pandas dataframe. I have four columns in my dataframe, but I would like to pick two of them and plot it. I plug in xaxis and yaxis values and draw three sub historgrams.
Here's how my code looks like:
fig = plt.figure(figsize=(9,7), dpi=100)
h = plt.hist(x=df_mean_h ['id'], y=df_mean_h ['mean'],
color='red', label='h')
c = plt.hist(x=df_mean_c ['id'], y=df_mean_c ['mean'],
color='blue', label='c')
o = plt.hist( x=df_mean_o['id'], y=df_mean_o ['mean'],
color='green', label='o')
plt.show()
When I try to see the histogram, it displays nothing on the screen. How should I fix my code?
plt.show()? Alternatively you could useDataFrame.plot.hist(by=None, bins=10, **kwds)see pandas.pydata.org/pandas-docs/stable/generated/…plt.show()but it throws an error sayingValueError: setting an array element with a sequence.df_mean_o['id']anddf_mean_o['id'].values