超簡単Pythonスクレイピングで競売不動産物件は売却基準価額の平均何倍で落札されてるのか?
BIT(不動産競売物件情報サイト)の過去データ(東京都・戸建て・過去三年)689件だと、売却基準価格の平均1.7倍で落札されてました。
PythonでpandasとBeautifulSoupを使用すれば10行ちょっとで
import pandas as pd
from bs4 import BeautifulSoup
soup = BeautifulSoup(open("bit.html").read(), "lxml")
trs = soup.select("table > tr")
y = []
for tr in trs:
tds = tr.select("td")
if len(tds) == 0:
continue
if len(tds[0].select("td > p > img")) == 0:
continue
y.append(round(int(tds[2].span.string.replace(",",""))/int(tds[1].span.string.replace(",","")),2))
df = pd.DataFrame({"y":y})
print(df.describe())
count 689.000000 # 件数
mean 1.708970 # 平均値
std 0.824373
min 0.800000
25% 1.300000
50% 1.530000 # 中央値
75% 1.870000
max 11.270000
BIT(不動産競売物件情報サイト)には過去データ分析ページがありますが、そちらでは知りたい情報(平均何倍?)が取れなかったので。
この記事が気に入ったらサポートをしてみませんか?