修复美团csv问题
This commit is contained in:
@@ -81,8 +81,6 @@ seaweed_new_result_df = seaweed_new_result_df.rename(columns={'_id': 'id', 'mapp
|
||||
'cubage_percent' : 'plot_ratio', 'virescence_percent': 'landscaping_ratio', 'estate_type2': 'property_type',
|
||||
'main_type': 'house_type', 'main_type_area': 'house_area'})
|
||||
|
||||
seaweed_new_result_df.to_csv(path + '/FJW_COMM_' + output_date + '.csv', sep='@', encoding='utf-8', index=False)
|
||||
|
||||
ck_delete_sql = "ALTER TABLE tmp.mt_community DELETE WHERE 1=1 "
|
||||
tmp_ck.execute(ck_delete_sql)
|
||||
|
||||
|
||||
@@ -30,11 +30,13 @@ for city in cities:
|
||||
# 小区量
|
||||
action['curr_city'] = city
|
||||
action['count'] = len(temp_df)
|
||||
number_columns = ['deal_num', 'school', 'market', 'subway', 'bank', 'hospital']
|
||||
|
||||
for item in result_df.columns:
|
||||
if type(result_df[item]) == int or type(result_df[item]) == float:
|
||||
if item in number_columns:
|
||||
action[item] = round(len(temp_df[temp_df[item] > 0]) * 100 / len(temp_df), 2)
|
||||
else:
|
||||
action[item] = round(len(temp_df[temp_df[item].notna()]) * 100 / len(temp_df), 2)
|
||||
action[item] = round(len(temp_df[temp_df[item] != '']) * 100 / len(temp_df), 2)
|
||||
if action['rent_price'] < 90:
|
||||
action['rent_flag'] = '租金覆盖率低于90%'
|
||||
if action['avg_price'] < 90:
|
||||
@@ -110,6 +112,16 @@ def up_to_nextcloud():
|
||||
aim_file_path = '共享/美团/' + output_date + '覆盖率统计.xlsx'
|
||||
nxc = NextCloud(endpoint=NEXTCLOUD_URL, user=NEXTCLOUD_USERNAME, password=NEXTCLOUD_PASSWORD, json_output=True)
|
||||
nxc.upload_file(aim_file_name, aim_file_path)
|
||||
columns = ['id', 'city', 'region', 'name', 'alias', 'address', 'addr_alias', 'avg_price', 'rent_price', 'lng',
|
||||
'lat',
|
||||
'block', 'loop_line_info', 'business_quarter', 'households', 'property_fee', 'car_site_count',
|
||||
'property_life', 'house_property',
|
||||
'all_area', 'build_area', 'plot_ratio', 'landscaping_ratio', 'property_type', 'build_type',
|
||||
'build_structure', 'finish_building_date',
|
||||
'developer', 'house_type', 'house_area', 'deal_num', 'district_facilitys', 'school', 'market', 'subway',
|
||||
'bank', 'hospital', 'status']
|
||||
final_result_df = result_df[columns]
|
||||
final_result_df.to_csv(path + '/FJW_COMM_' + output_date + '.csv', sep='@', encoding='utf-8', index=False)
|
||||
# 上传计算结果至cloud
|
||||
nxc.upload_file(path + '/FJW_COMM_' + output_date + ".csv", '共享/美团/FJW_COMM_' + output_date + ".csv")
|
||||
|
||||
@@ -129,4 +141,4 @@ def send_msg():
|
||||
|
||||
up_to_nextcloud()
|
||||
save2_clickhouse()
|
||||
send_msg()
|
||||
#send_msg()
|
||||
Reference in New Issue
Block a user