Skip to content

Commit

Permalink
modify
Browse files Browse the repository at this point in the history
  • Loading branch information
mryuan0428 committed Jun 24, 2018
1 parent 54308c5 commit acf6734
Show file tree
Hide file tree
Showing 648 changed files with 3,512 additions and 8,212 deletions.
258 changes: 27 additions & 231 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,31 @@
# 链家网数据分析

## Dataset

> described in `dataset.py`
#语言:python3
```
|--data_spider文件夹
|--dataset文件夹 -- 爬取的原始数据
|--Spider.py -- 爬虫
|--url.txt -- 爬虫url
|--数据结构 -- 说明爬到数据的信息
|--process_first文件夹
|--update.py -- 统一原始数据格式,缺失标签补空值
|--dataset2文件夹 -- 小区名转换成经纬坐标后的数据集
|--POI_COMMUNITY_SH文件夹 -- 之前爬取的上海小区POI点
|--modifyCommunity.py -- 将POI点提取到POI_COMMUNITY_SH文件夹下的community0.txt文件
|--modifyCoordinate.py -- 将小区名、经纬度坐标、房屋均价信息提取到coordinate.csv文件,便于后边可视化
|--searchForCommunity.py -- 将dataset中小区名转换成经纬坐标后,保存在dataset2
|--map.py -- 画出上海房价分布热力图
|--map.png -- 上海房价分布热力图
|--process&module文件夹
|--dataset.py -- 包含大量数据处理函数,如facility_process(),dataset()
|--facility_process()函数 -- 将数据集中关于设备的描述关键词分类
|--dataset()函数 -- 数据集接口,返回dict类型的数据集
|--dataset3文件夹 -- facility_process()处理过后的数据集
|--建模过程.docx -- 简述建模过程,其中说明了process&module文件夹下tocsv.py,data_c.csv……文件的意义
|--result_pictures文件夹 -- 建模过程中各个模型的回归曲线
|--……其余文件,包含训练、测试数据集,建模文件,模型… 在建模过程.docx中有说明
```

```python
```
dataset()函数用法说明:
dataset(*, src='./data2', dst='./dataset', load_from_source=False)
```

Expand All @@ -13,231 +34,6 @@ dataset(*, src='./data2', dst='./dataset', load_from_source=False)
* `dst` -- `str`, dataset path
* `load_from_source` -- `bool`, flag if load from source (`False` in default)

- Returns:
* `Dataset<Info>` -- parsed dataset (for more information, see notes below)
```
(Info) Dataset
|-- (int) id -- ID
|-- (str) title -- 标题
|-- (str) heading -- 副标题
|-- (float) price -- 总价(单位为元)
|-- (float) average -- 均价(单位为元/平米)
|-- (Info) community -- 小区
| |-- (str) name -- 小区名称
| |-- (str) intro -- 小区介绍
| |-- (tuple<float>) coordinate -- 小区坐标
|-- (Info) region -- 所在区域
| |-- (int) district -- 行政区划编码
| |-- (str) station -- 所处地铁站辐射区
| |-- (str) ring -- 外中内环情况
|-- (Info) type -- 房屋户型
| |-- (int) room -- 居室数量
| |-- (int) saloon -- 客厅数量
| |-- (int) kitchen -- 厨房数量
| |-- (int) bath -- 卫浴数量
|-- (Info) floor -- 所在楼层
| |-- (int) level -- 高中低楼层或地下室
| |-- (int) total -- 总楼层数
|-- (float) scale -- 建筑面积(单位为平方米)
|-- (int) structure -- 户型结构
|-- (float) area -- 套内面积(单位为平方米)
|-- (int) building -- 建筑类型
|-- (tuple<int>) orientation -- 房屋朝向
|-- (int) framework -- 建筑结构
|-- (Info) decoration -- 装修
| |-- (int) condition -- 装修情况
| |-- (str) description -- 装修描述
|-- (Info) ratio -- 梯户比例
| |-- (int) lift -- 电梯数量
| |-- (int) apt -- 每层户数
|-- (int) elevator -- 配备电梯
|-- (int) title_term -- 产权年限
|-- (datetime) listing_time -- 挂牌时间
|-- (int) rights -- 交易权属
|-- (datetime) last_transaction -- 上次交易
|-- (int) purpose -- 房屋用途
|-- (int) house_term -- 房屋年限
|-- (int) ownership -- 产权所属
|-- (Info) mortgage -- 抵押
| |-- (bool) flag -- 是否抵押
| |-- (tuple<str>) info -- 抵押信息
| |-- (str) comment -- 权属抵押
|-- (int) deed -- 房本备件
|-- (tuple<int>) tags -- 房源标签
|-- (str) intro -- 房源标签
|-- (tuple<int>) facility -- 周边配套
|-- (str) inspiration -- 核心卖点
|-- (str) transport -- 交通出行
|-- (str) detail -- 售房详情
|-- (str) tax -- 税费解析
|-- (str) suitable -- 适宜人群
|-- (int) villa -- 别墅类型
|-- (str) analysis -- 投资分析
```

- Terminology:
* `coordinate` (小区坐标):
```python
(
0.0, # 经度
0.0, # 纬度
)
```
* `district` (行政区划编码):
```python
DIVISION_CODE = {
'黄埔' : 310101,
'徐汇' : 310104,
'长宁' : 310105,
'静安' : 310106,
'普陀' : 310107,
'虹口' : 310109,
'杨浦' : 310110,
'闵行' : 310112,
'宝山' : 310113,
'嘉定' : 310114,
'浦东' : 310115,
'金山' : 310116,
'松江' : 310117,
'青浦' : 310118,
'奉贤' : 310120,
'崇明' : 310151,
}
```
* `level` (高中低楼层或地下室):
```python
FLOOR_LEVEL = {
'' : 0,
'' : 1,
'' : 2,
'地下室' : 4,
}
```
* `structure` (户型结构):
```python
STRUCTURE_CODE = {
'复式' : 0,
'平层' : 1,
'跃层' : 2,
'错层' : 3,
}
```
* `building` (建筑类型):
```python
BUILDING_TYPE = {
'塔楼' : 0,
'板楼' : 1,
}
```
* `orientation` (房屋朝向):
```python
(
0, #
0, # 东南
0, #
0, # 西南
0, # 西
0, # 西北
0, #
0, # 东北
)
```
* `framework` (建筑结构):
```python
FRAMEWORK_CODE = {
'砖混结构' : 0,
'钢混结构' : 1,
}
```
* `condition` (装修情况):
```python
CONDITION_CODE = {
'毛坯' : 0,
'简装' : 1,
'精装' : 2,
}
```
* `elevator` (配备电梯):
```python
ELEVATOR_CODE = {
'' : 0,
'' : 1,
}
```
* `rights` (交易权属):
```python
TRADING_RIGHTS = {
'动迁安置房' : 0,
'售后公房' : 1,
'商品房' : 2,
}
```
* `purpose` (房屋用途):
```python
PURPOSE_CODE = {
'别墅': 0,
'新式里弄': 1,
'旧式里弄': 2,
'普通住宅': 3,
'老公寓': 4,
'花园洋房': 5,
}
```
* `house_term` (房屋年限):
```python
HOUSE_TERM = {
'未满两年': 0,
'满两年': 1,
'满五年': 2,
}
```
* `ownership` (产权所属):
```python
PROPERTY_OWNERSHIP = {
'非共有' : 0,
'共有' : 1,
}
```
* `deed` (房本备件):
```python
DEED_CODE = {
'未上传房本照片' : 0,
'已上传房本照片' : 1,
}
```
* `tags` (房源标签):
```python
(
0, # 房本满两年
0, # 房本满五年
0, # 随时看房
0, # 地铁
)
```
* `facility` (周边配套):
```python
(
0, # 购物:购物, 市场, 商场, 商铺, 巴黎春天, 卜蜂莲花, 大润发, 乐购
0, # 教育:学校, 学区, 幼儿园, 小学, 中学, 大学
0, # 交通:号线, 地铁, 公交, 车站
0, # 健身:健身, 球场, 游泳
0, # 环境:公园, 绿化
0, # 医疗:医
)
```
* `villa` (别墅类型):
```python
VILLA_TYPE = {
'联排': 0,
'独栋': 1,
'双拼': 2,
'叠拼': 3,
}
```
* for `tuple` vecters, `0` for `False`, `1` for `True`
* for `int` flags, `-1` for unexpected/unknown value
* for `str` contents, `None` for empty fields

- Notes:
* `Info` turn dictionaries into object-like instances
- inherits from `dict` type
Expand Down
Loading

0 comments on commit acf6734

Please sign in to comment.