本文将使用Python的绘图库Matplotlib,通过数据可视化分析影响房价的主要因素。
波士顿房价数据集
波士顿房价数据集来源于1978年美国某经济学杂志上。该数据集包含若干波士顿房屋的价格及其各项数据,每个数据项包含14个数据,分别是犯罪率、是否在河边和平均房间数等相关信息,其中最后一个数据是房屋中间价。
变量名称解释
CRIM: per capita crime rate by town 每个城镇人均犯罪率
ZN: proportion of residential land zoned for lots over 25,000 sq.ft. 超过25000平方英尺用地划为居住用地的百分比
INDUS: proportion of non-retail business acres per town 非零售商用地百分比
CHAS: Charles River dummy variable (= 1 if tract bounds river; 0 otherwise) 是否靠近查尔斯河
NOX: nitric oxides concentration (parts per 10 million) 氮氧化物浓度
RM: average number of rooms per dwelling 住宅平均房间数目
AGE: proportion of owner-occupied units built prior to 1940 1940年前建成自用单位比例
DIS: weighted distances to five Boston employment centres 到5个波士顿就业服务中心的加权距离
RAD: index of accessibility to radial highways 无障碍径向高速公路指数
TAX: full-value property-tax rate per $