Created
July 1, 2021 13:50
-
-
Save wsuo/f5372f3c347f3135d6c0565e5fc9bb35 to your computer and use it in GitHub Desktop.
0702-作业
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import matplotlib.pyplot as plt | |
''' | |
author: 硕子鸽 | |
date: 2021-07-01 | |
content: house_price | |
''' | |
data = pd.read_csv('data2.csv') | |
def func(param): | |
return param[0] * param[1] | |
# 计算每一套房子的总价 | |
data['total_price'] = data[['AREA', 'price']].apply(func, axis=1) | |
data.plot.scatter(x='dist', y='price', color='r') | |
# 房间编号是否影响单价 | |
data.plot.scatter(x='roomnum', y='price') | |
# 客厅数是否影响单价 | |
data.plot.scatter(x='halls', y='price', color='r') | |
# 面积是否影响单价 | |
data.plot.scatter(x='AREA', y='price') | |
# 楼层高低是否影响单价 | |
data.plot.scatter(x='floor', y='price', color='r') | |
# 有无地铁是否影响单价 | |
data.plot.scatter(x='subway', y='price') | |
# 有无学校是否影响单价 | |
data.plot.scatter(x='school', y='price', color='r') | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment