I use Python 3.12.1 and pandas 2.2.0.
I find df.plot(kind='bar')
and df.plot.bar()
work in a similar (or even the same?) way.
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.plot.html
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.plot.bar.html
You are so close to the final answer. As you mentioned in your code, According to the documentation, what these methods return is matplotlib.axes.Axes
or numpy.ndarray
.
Here is what df.plot(kind='bar')
returns :
And here is what df.plot.bar()
returns :
So the output is equivalent when you are using them with default argument values, Unless you change the backend
in df.plot()
.