In [4]:
import matplotlib.pyplot as plt

In [5]:
import pandas as pd

In [6]:
boston=pd.read_csv("https://vincentarelbundock.github.io/Rdatasets/csv/MASS/Boston.csv")

In [8]:
boston.head()


Out[8]:
Unnamed: 0 crim zn indus chas nox rm age dis rad tax ptratio black lstat medv
0 1 0.00632 18.0 2.31 0 0.538 6.575 65.2 4.0900 1 296 15.3 396.90 4.98 24.0
1 2 0.02731 0.0 7.07 0 0.469 6.421 78.9 4.9671 2 242 17.8 396.90 9.14 21.6
2 3 0.02729 0.0 7.07 0 0.469 7.185 61.1 4.9671 2 242 17.8 392.83 4.03 34.7
3 4 0.03237 0.0 2.18 0 0.458 6.998 45.8 6.0622 3 222 18.7 394.63 2.94 33.4
4 5 0.06905 0.0 2.18 0 0.458 7.147 54.2 6.0622 3 222 18.7 396.90 5.33 36.2

In [9]:
boston=boston.drop("Unnamed: 0",1)

In [10]:
var=boston.groupby('chas').medv.mean().reset_index()

In [11]:
plt.plot(var.chas,var.medv)


Out[11]:
[<matplotlib.lines.Line2D at 0x8078ba8>]

In [12]:
plt.xlabel("Charles River Facing Tract")


Out[12]:
<matplotlib.text.Text at 0x7ebe0f0>

In [13]:
plt.ylabel("Median Prices")


Out[13]:
<matplotlib.text.Text at 0x7ffc5c0>

In [14]:
plt.show()



In [ ]: