In [1]:
import matplotlib.pyplot as plt

In [2]:
import pandas as pd

In [3]:
cars=pd.read_csv("https://vincentarelbundock.github.io/Rdatasets/csv/datasets/mtcars.csv")

In [4]:
cars=cars.drop("Unnamed: 0",1)

In [5]:
var=cars.groupby('cyl').mpg.mean().reset_index()

In [6]:
plt.plot(var.cyl,var.mpg)


Out[6]:
[<matplotlib.lines.Line2D at 0x941db00>]

In [7]:
plt.xlabel("Cylinders")


Out[7]:
<matplotlib.text.Text at 0x904b1d0>

In [8]:
plt.ylabel("Mean Mileage Per Gallon")


Out[8]:
<matplotlib.text.Text at 0x93df898>

In [9]:
plt.title("Mileage versus Cylinders")


Out[9]:
<matplotlib.text.Text at 0x93fe668>

In [10]:
plt.show()



In [ ]: