17 lines
824 B
Python
17 lines
824 B
Python
import matplotlib.pyplot as plt
|
|
import pandas as pd
|
|
import common
|
|
|
|
mongo_uri = 'mongodb://developer:G00IDCDEV12385@192.168.0.136:28017/?connectTimeoutMS=60000&socketTimeoutMS=10000000'
|
|
HOUSE_RENT = common.get_mongodb_collection("mongodb://192.168.0.105:27018/", "vip_site", "esf_houseRent")
|
|
DISTRICT_RENT = common.get_mongodb_collection(mongo_uri, "fangjia_rent", "district_room_rent")
|
|
stats = list(DISTRICT_RENT.find({"city": "北京", "region": "朝阳", "name": "甜水园"}))
|
|
df = pd.DataFrame(stats)
|
|
df.dropna()
|
|
df = df[["city", "region", "name", "date", "room", "rent_price"]]
|
|
df["date"] = df["date"].apply(lambda x: common.parse_date(str(x), '%Y%m'))
|
|
room1_df = df[df["room"] == 2]
|
|
room1_df = room1_df.sort_values(by="date")
|
|
fig, ax = plt.subplots()
|
|
ax.plot(room1_df["date"], room1_df["rent_price"], 'h-.')
|
|
plt.show() |