|
@@ -331,21 +331,22 @@ def data_process():
|
|
|
df.insert(0, '年月', year_month)
|
|
|
|
|
|
# 打印DataFrame的基本信息
|
|
|
- print(df.info())
|
|
|
+ df.info()
|
|
|
|
|
|
# 将处理后的数据保存为CSV文件
|
|
|
df.to_csv(
|
|
|
path_or_buf=output_path,
|
|
|
index=False,
|
|
|
header=[
|
|
|
- 'year_month', 'first_unit', 'second_unit', 'third_unit', 'land_name', 'land_id', 'land_ownership',
|
|
|
- 'use_right_type', 'land_use', 'acquisition_date', 'idle_start_date', 'site_name', 'site_id',
|
|
|
- 'address', 'investor', 'management_level', 'ownership_status', 'usage_status', 'total_land_area',
|
|
|
+ 'year_month', 'first_unit', 'second_unit', 'third_unit', 'land_name', 'inventory_status',
|
|
|
+ 'inventory_situation', 'modify', 'to_be_verified', 'land_no', 'land_id', 'land_ownership',
|
|
|
+ 'use_right_type', 'land_use', 'acquisition_date', 'idle_start_date', 'site_name', 'site_id', 'address',
|
|
|
+ 'investor', 'management_level', 'ownership_status', 'usage_status', 'total_land_area',
|
|
|
'land_area_self_use', 'land_area_idle', 'land_area_rent', 'land_area_unusable', 'has_land_deed',
|
|
|
- 'no_land_deed_reason', 'land_preservation_risk', 'open_space', 'courtyard', 'unrelated_assets',
|
|
|
- 'assets_num', 'assets_tag_num', 'responsible_department', 'person_in_charge', 'lng_jt', 'lat_jt',
|
|
|
- 'property_owner', 'special_specification', 'area_no', 'area_name', 'city_no', 'city_name', 'city_id',
|
|
|
- 'city', 'district_id', 'district'
|
|
|
+ 'no_land_deed_reason', 'land_preservation_risk', 'independent_parcel_of_land', 'open_space', 'courtyard',
|
|
|
+ 'unrelated_assets', 'assets_num', 'assets_tag_num', 'responsible_department', 'person_in_charge', 'lng_jt',
|
|
|
+ 'lat_jt','property_owner', 'special_specification', 'area_no', 'area_name', 'city_no', 'city_name',
|
|
|
+ 'city_id', 'city', 'district_id', 'district'
|
|
|
],
|
|
|
encoding='utf-8-sig' # 确保中文字符不会乱码
|
|
|
)
|
|
@@ -357,7 +358,7 @@ def data_import():
|
|
|
# 目标表和文件信息
|
|
|
table = "house.land_month" # 数据库目标表名
|
|
|
# 表字段列名,用于指定导入数据的列顺序
|
|
|
- columns = "year_month,first_unit,second_unit,third_unit,land_name,land_id,land_ownership,use_right_type,land_use,acquisition_date,idle_start_date,site_name,site_id,address,investor,management_level,ownership_status,usage_status,total_land_area,land_area_self_use,land_area_idle,land_area_rent,land_area_unusable,has_land_deed,no_land_deed_reason,land_preservation_risk,open_space,courtyard,unrelated_assets,assets_num,assets_tag_num,responsible_department,person_in_charge,lng_jt,lat_jt,property_owner,special_specification,area_no,area_name,city_no,city_name,city_id,city,district_id,district"
|
|
|
+ columns = "year_month,first_unit,second_unit,third_unit,land_name,inventory_status,inventory_situation,modify,to_be_verified,land_no,land_id,land_ownership,use_right_type,land_use,acquisition_date,idle_start_date,site_name,site_id,address,investor,management_level,ownership_status,usage_status,total_land_area,land_area_self_use,land_area_idle,land_area_rent,land_area_unusable,has_land_deed,no_land_deed_reason,land_preservation_risk,independent_parcel_of_land,open_space,courtyard,unrelated_assets,assets_num,assets_tag_num,responsible_department,person_in_charge,lng_jt,lat_jt,property_owner,special_specification,area_no,area_name,city_no,city_name,city_id,city,district_id,district"
|
|
|
# 构造执行 PowerShell 脚本的命令
|
|
|
command = f"powershell -File {script_path} -db_host {db_host} -db_port {db_port} -db_username {db_username} -db_password {db_password} -dbname {dbname} -table {table} -filename {output_path} -columns {columns}"
|
|
|
# 打印生成的命令,方便调试和日志记录
|