DataFrame.plot()

noun

say it: “DAY-tuh-frame dot PLOT” /ˈdeɪtəˌfreɪm dɑt ˈplɑt/

A pandas method that draws a table or column as a chart in one line, using matplotlib.

What does DataFrame.plot() do in pandas?

DataFrame.plot() is the pandas method that draws a DataFrame or a Series as a chart, with matplotlib doing the drawing. A line is the default; kind= picks another, such as "bar", "barh", "scatter" or "hist". ax=ax draws on an Axes you made, and the method hands back the Axes it drew on.

import matplotlib.pyplot as plt
monthly = daily.groupby(daily["date"].dt.month)["cones_sold"].sum()
fig, ax = plt.subplots()
monthly.plot(kind="bar", ax=ax, rot=0)   # one bar per month
ax.set_title("Cones sold each month, 2025")

In a sentence

  • “DataFrame.plot() drew the monthly totals as a line in one call.”
  • “With kind="bar", DataFrame.plot() turned the groupby result into a bar chart.”

Level: Journeyman · More Python terms at this level

Updated