基于Python的租房信息可视化及价格预测
2021-02-28李涛





摘 要:文章以都匀市出租房为例,运用Python对安居客网上房源信息进行采集,对获取的数据进行清洗和处理,并从数据中选择小区、户型、朝向、住房面积和租房价格等特征进行数据分析和可视化展示,最后使用随机森林模型对租金价格进行预测。通过分析与价格预测,以期帮助寻租者在选择房源时能获取特定的需求信息,从而做出更好的决策。
关键词:出租房;数据分析;可视化;租金;随机森林
中图分类号:TP311;TP181 文献标识码:A文章编号:2096-4706(2021)16-0096-04
Rental Information Visualization and Price Prediction Based on Python
LI Tao
(School of Computer and Information, Qiannan Normal University for Nationalities, Duyun 558000, China)
Abstract: Taking the rental housing in Duyun City as an example, this paper uses Python to collect the housing source information of Anjuke real estate network, cleans and processes the obtained data, selects the characteristic data of community, house type, orientation, housing area and rental price from the data for data analysis and visual display, and finally uses the random forest model to predict the rental price. Through analysis and price forecasting, it is expected to help renters obtain required information when selecting houses, so as to make better decisions.
Keywords: rental housing; data analysis; visualization; rent; random forest
0 引 言
在中國持续城镇化建设过程中,农村富余劳动力逐步向城市进行转移[1]。由于现阶段城镇的房价高,买房比较困难,相当多买不起房的人只能租房。因此,这些年来国内的租房人群十分庞大,市场需求也很旺盛。与此同时,房价是在不断上涨的,租金也随着房价的上涨而上涨。文章以贵州省黔南州都匀市为例,以安居客租房网站上的挂牌房源数据为研究对象,对采集原始数据进行清理、异常值和缺失值处理以及特征向量数字化处理等工作,并选取相应特征向量进行可视化分析。在此基础上,运用随机森林预测模型来预测租金价格以及走向。其工作主要集中在以下6个方面:
(1)选取并收集URL,存储在待抓取的URL列表。
(2)使用Requests库抓取页面。
(3)使用Beautiful Soup解析页面内容。
(4)数据存储及预处理。
(5)分析数据并可视化。
(6)运用随机森林模型预测房租价格。
通过分析,可以了解到目前市面上出租房各项基本特征及房源分布情况,并对不同区域房租价格进行预测,为群体大众进行租房决策提供了参考意见,还会对当地政府合理地规范租房市场提供重要的数据支持。……
