Several series

Multi-column plots.

Multi-column plots.

Goal

Run every block.

df = pd.DataFrame({
    "mango": [12, 7, 11, 10, 6],
    "soda": [9, 8, 4, 8, 6],
}, index=["Nairobi", "Mombasa", "Kisumu", "Nakuru", "Eldoret"])
df.plot(kind="bar")
plt.title("Two products")
plt.show()
df = pd.DataFrame({
    "mango": [12, 7, 11],
    "soda": [9, 8, 4],
}, index=["Nairobi", "Mombasa", "Kisumu"])
df.plot(kind="line", marker="o")
plt.show()
df = pd.DataFrame({
    "city": ["Nairobi", "Mombasa", "Kisumu", "Nakuru", "Eldoret"],
    "units": [21, 15, 15, 18, 12],
    "shillings": [2100, 1500, 1480, 1750, 1190],
})
df.plot(x="city", y=["units", "shillings"], kind="bar")
plt.show()
print("Several numeric columns → several series.")
Pitfall

Always plt.show().