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]:
In [7]:
plt.xlabel("Cylinders")
Out[7]:
In [8]:
plt.ylabel("Mean Mileage Per Gallon")
Out[8]:
In [9]:
plt.title("Mileage versus Cylinders")
Out[9]:
In [10]:
plt.show()
In [ ]: