修复城市涨跌幅缺失
This commit is contained in:
@@ -72,17 +72,19 @@ def sync_by_city(city, total_seaweed_df):
|
|||||||
|
|
||||||
# 12个月均价涨跌幅
|
# 12个月均价涨跌幅
|
||||||
avg_price_up_and_downs_df = commutils.get_avg_price_up_and_downs(cities=[city], months=-12)
|
avg_price_up_and_downs_df = commutils.get_avg_price_up_and_downs(cities=[city], months=-12)
|
||||||
avg_price_up_and_downs_df = avg_price_up_and_downs_df[['city', 'region', 'district_name', 'up_and_downs']]
|
if len(avg_price_up_and_downs_df) > 0:
|
||||||
avg_price_up_and_downs_df = avg_price_up_and_downs_df.rename(
|
avg_price_up_and_downs_df = avg_price_up_and_downs_df[['city', 'region', 'district_name', 'up_and_downs']]
|
||||||
columns={'district_name': 'name', 'up_and_downs': 'year_on_year'})
|
avg_price_up_and_downs_df = avg_price_up_and_downs_df.rename(
|
||||||
seaweed_df = pd.merge(seaweed_df, avg_price_up_and_downs_df, how='left', on=['city', 'region', 'name'])
|
columns={'district_name': 'name', 'up_and_downs': 'year_on_year'})
|
||||||
|
seaweed_df = pd.merge(seaweed_df, avg_price_up_and_downs_df, how='left', on=['city', 'region', 'name'])
|
||||||
|
|
||||||
# 近半年均价涨跌幅
|
# 近半年均价涨跌幅
|
||||||
avg_price_up_and_downs_df = commutils.get_avg_price_up_and_downs(cities=[city], months=-6)
|
avg_price_up_and_downs_df = commutils.get_avg_price_up_and_downs(cities=[city], months=-6)
|
||||||
avg_price_up_and_downs_df = avg_price_up_and_downs_df[['city', 'region', 'district_name', 'up_and_downs']]
|
if len(avg_price_up_and_downs_df) > 0:
|
||||||
avg_price_up_and_downs_df = avg_price_up_and_downs_df.rename(
|
avg_price_up_and_downs_df = avg_price_up_and_downs_df[['city', 'region', 'district_name', 'up_and_downs']]
|
||||||
columns={'district_name': 'name', 'up_and_downs': 'half_on_year'})
|
avg_price_up_and_downs_df = avg_price_up_and_downs_df.rename(
|
||||||
seaweed_df = pd.merge(seaweed_df, avg_price_up_and_downs_df, how='left', on=['city', 'region', 'name'])
|
columns={'district_name': 'name', 'up_and_downs': 'half_on_year'})
|
||||||
|
seaweed_df = pd.merge(seaweed_df, avg_price_up_and_downs_df, how='left', on=['city', 'region', 'name'])
|
||||||
|
|
||||||
# 平米租金
|
# 平米租金
|
||||||
rent_price_df = commutils.get_rent_price(city=city)
|
rent_price_df = commutils.get_rent_price(city=city)
|
||||||
|
|||||||
Reference in New Issue
Block a user