Reputation: 25
For example if I have this dataframe and plot a density plot:
df = pd.DataFrame(np.random.randn(6,6))
df.plot(kind='density', subplots=True, layout=(3,2), sharex=False, sharey=False,
fontsize=1)
pyplot.show()
It yields
The thing is that if I try to do the same with boxplot I get and error:
df.plot(kind='box', subplots=True, layout=(3,2), sharex=False, sharey=False,
fontsize=1)
pyplot.show()
I get the following error:
IndexError: index 0 is out of bounds for axis 0 with size 0
Thanks
Upvotes: 2
Views: 976
Reputation: 150745
Seems like there's a bug for integer columns. This works:
df = pd.DataFrame(np.random.randn(6,6))
df.columns=list('abcdef')
df.plot.box(subplots=True, layout=(3,2))
Output:
Or change the column type to str
:
(df.rename(columns=lambda x: str(x))
.plot.box(subplots=True, layout=(3,2))
)
Output:
Upvotes: 2