Why pandas has two funcitons for Boxplot : pandas.DataFrame.plot.box()
and pandas.DataFrame.boxplot()
?
df = pd.DataFrame(np.random.rand(10, 5), columns=['A', 'B', 'C', 'D', 'E'])
df.plot.box()
df.boxplot()
Both return a 'matplotlib.axes._subplots.AxesSubplot' object. Obviously, they are calling upon different parts of the pandas library to execute.
One of the consequences of this is that the pandas.DataFrame.plot.box() method uses the FramePlotMethods class where "grid = None" and pandas.DataFrame.boxplot() has "grid = True" by default. You'll notice this in the background lines in your two charts.
Additionally, .boxplot() can't be used on a Series, whereas .plot's can.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With