diff --git a/入模数据/丽水.xlsx b/入模数据/丽水.xlsx index 3ecd108..42583ad 100644 Binary files a/入模数据/丽水.xlsx and b/入模数据/丽水.xlsx differ diff --git a/入模数据/台州.xlsx b/入模数据/台州.xlsx index 7263cb0..dcbc913 100644 Binary files a/入模数据/台州.xlsx and b/入模数据/台州.xlsx differ diff --git a/入模数据/嘉兴.xlsx b/入模数据/嘉兴.xlsx index 937b2ca..17661b5 100644 Binary files a/入模数据/嘉兴.xlsx and b/入模数据/嘉兴.xlsx differ diff --git a/入模数据/宁波.xlsx b/入模数据/宁波.xlsx index 5995cb9..301d78c 100644 Binary files a/入模数据/宁波.xlsx and b/入模数据/宁波.xlsx differ diff --git a/入模数据/杭州.xlsx b/入模数据/杭州.xlsx index 3617ba1..381127e 100644 Binary files a/入模数据/杭州.xlsx and b/入模数据/杭州.xlsx differ diff --git a/入模数据/温州.xlsx b/入模数据/温州.xlsx index 5121488..6f05faf 100644 Binary files a/入模数据/温州.xlsx and b/入模数据/温州.xlsx differ diff --git a/入模数据/湖州.xlsx b/入模数据/湖州.xlsx index c350cf0..a073d3f 100644 Binary files a/入模数据/湖州.xlsx and b/入模数据/湖州.xlsx differ diff --git a/入模数据/绍兴.xlsx b/入模数据/绍兴.xlsx index 1dcd1d1..d5d5032 100644 Binary files a/入模数据/绍兴.xlsx and b/入模数据/绍兴.xlsx differ diff --git a/入模数据/舟山.xlsx b/入模数据/舟山.xlsx index 66ee09d..c7bec52 100644 Binary files a/入模数据/舟山.xlsx and b/入模数据/舟山.xlsx differ diff --git a/入模数据/衢州.xlsx b/入模数据/衢州.xlsx index b4328f3..55268bb 100644 Binary files a/入模数据/衢州.xlsx and b/入模数据/衢州.xlsx differ diff --git a/入模数据/金华.xlsx b/入模数据/金华.xlsx index c9ab342..5b23610 100644 Binary files a/入模数据/金华.xlsx and b/入模数据/金华.xlsx differ diff --git a/各地级市日电量模型/jiaxing.bin b/各地级市日电量模型/jiaxing.bin index f2dc1c5..016f208 100644 Binary files a/各地级市日电量模型/jiaxing.bin and b/各地级市日电量模型/jiaxing.bin differ diff --git a/各地级市日电量模型/丽水.py b/各地级市日电量模型/丽水.py index 8fdb9f7..4c8fe55 100644 --- a/各地级市日电量模型/丽水.py +++ b/各地级市日电量模型/丽水.py @@ -83,20 +83,19 @@ print(goal2) import numpy as np X_eval = np.array([ - [16.2, 3.2, 0, 0, 1, 2023], - [17.9, 6.4, 0, 0, 1, 2023], - [15.7, 9.0, 0, 0, 1, 2023], - [19.2, 8.1, 0, 3, 1, 2023], - [11.8, 2.4, 0, 3, 1, 2023] + [16.2, 6.5, 0, 0, 1, 2023], + [15.9, 6.9, 0, 0, 1, 2023], + [19.1, 7.4, 0, 3, 1, 2023], + [13.4, 3.2, 0, 3, 1, 2023] ]) # X_eval = np.array([[6.2,5.1,0,0,1,2023]]) print(model.predict(X_eval)) result = model.predict(X_eval) -result = pd.DataFrame(result, index=['2023-12-27', '2023-12-28','2023-12-29','2023-12-30','2023-12-31' ]) +result = pd.DataFrame(result, index=['2023-12-28','2023-12-29','2023-12-30','2023-12-31' ]) result = pd.concat((result_eval['eval'], result)) result.index = result.index.map(lambda x: str(x)[:10]) result.columns = ['预测值'] print(result) -with pd.ExcelWriter(r'C:\Users\鸽子\Desktop\市区日电量预测_1228.xlsx',mode='a',if_sheet_exists='replace',engine='openpyxl') as writer: +with pd.ExcelWriter(r'C:\Users\鸽子\Desktop\市区日电量预测_1229.xlsx',mode='a',if_sheet_exists='replace',engine='openpyxl') as writer: result.to_excel(writer,sheet_name='丽水') \ No newline at end of file diff --git a/各地级市日电量模型/台州.py b/各地级市日电量模型/台州.py index 8c6a1ef..80dffb6 100644 --- a/各地级市日电量模型/台州.py +++ b/各地级市日电量模型/台州.py @@ -82,20 +82,19 @@ print(result_eval) import numpy as np X_eval = np.array([ - [17.3, 2.2, 0, 0, 1, 2023], - [19, 5.5, 0, 0, 1, 2023], - [16, 6.5, 0, 0, 1, 2023], - [19.7, 7.9, 0, 3, 1, 2023], - [11.9, 3.2, 0, 3, 1, 2023] + [17.4, 5.4, 0, 0, 1, 2023], + [15.8, 4.8, 0, 0, 1, 2023], + [19.4, 8.9, 0, 3, 1, 2023], + [13.3, 3.3, 0, 3, 1, 2023] ]) print(model.predict(X_eval)) result = model.predict(X_eval) -result = pd.DataFrame(result, index=['2023-12-27', '2023-12-28', '2023-12-29', '2023-12-30', '2023-12-31']) +result = pd.DataFrame(result, index=['2023-12-28', '2023-12-29', '2023-12-30', '2023-12-31']) result = pd.concat((result_eval['eval'], result)) result.index = result.index.map(lambda x: str(x)[:10]) result.columns = ['预测值'] print(result) -with pd.ExcelWriter(r'C:\Users\鸽子\Desktop\市区日电量预测_1228.xlsx', mode='a', if_sheet_exists='replace', +with pd.ExcelWriter(r'C:\Users\鸽子\Desktop\市区日电量预测_1229.xlsx', mode='a', if_sheet_exists='replace', engine='openpyxl') as writer: result.to_excel(writer, sheet_name='台州') diff --git a/各地级市日电量模型/嘉兴.py b/各地级市日电量模型/嘉兴.py index 4993ce2..d26231a 100644 --- a/各地级市日电量模型/嘉兴.py +++ b/各地级市日电量模型/嘉兴.py @@ -81,20 +81,19 @@ loaded_model.load_model('jiaxing.bin') import numpy as np X_eval = np.array([ - [13.8, 2.1, 0, 0, 1, 2023], - [12.1, 1.7, 0, 0, 1, 2023], - [10.3, 3.0, 0, 0, 1, 2023], - [12.1, 7.1, 0, 3, 1, 2023], - [8.2, 1.3, 0, 3, 1, 2023] + [10.7, 0.9, 0, 0, 1, 2023], + [9.8, 4.5, 0, 0, 1, 2023], + [11.2, 5.3, 0, 3, 1, 2023], + [9.0, 2.1, 0, 3, 1, 2023] ]) print(model.predict(X_eval)) result = model.predict(X_eval) -result = pd.DataFrame(result, index=['2023-12-27', '2023-12-28', '2023-12-29', '2023-12-30', '2023-12-31']) +result = pd.DataFrame(result, index=['2023-12-28', '2023-12-29', '2023-12-30', '2023-12-31']) result = pd.concat((result_eval['eval'], result)) result.index = result.index.map(lambda x: str(x)[:10]) result.columns = ['预测值'] print(result) -with pd.ExcelWriter(r'C:\Users\鸽子\Desktop\市区日电量预测_1228.xlsx', mode='a', if_sheet_exists='replace', +with pd.ExcelWriter(r'C:\Users\鸽子\Desktop\市区日电量预测_1229.xlsx', mode='a', if_sheet_exists='replace', engine='openpyxl') as writer: result.to_excel(writer, sheet_name='嘉兴') diff --git a/各地级市日电量模型/宁波.py b/各地级市日电量模型/宁波.py index ff78ce9..eb94732 100644 --- a/各地级市日电量模型/宁波.py +++ b/各地级市日电量模型/宁波.py @@ -80,21 +80,19 @@ print(result_eval) import numpy as np X_eval = np.array([ - - [16.0, 3.0, 0, 0, 1, 2023], - [14.8, 5.0, 0, 0, 1, 2023], - [12.8, 4.8, 0, 0, 1, 2023], - [20.9, 6.8, 0, 3, 1, 2023], - [9.5, 2.6, 0, 3, 1, 2023] + [14.4, 3.7, 0, 0, 1, 2023], + [12.6, 5.5, 0, 0, 1, 2023], + [16.4, 7.6, 0, 3, 1, 2023], + [10.9, 3.7, 0, 3, 1, 2023] ]) print(model.predict(X_eval)) result = model.predict(X_eval) -result = pd.DataFrame(result, index=['2023-12-27', '2023-12-28', '2023-12-29', '2023-12-30', '2023-12-31']) +result = pd.DataFrame(result, index=['2023-12-28', '2023-12-29', '2023-12-30', '2023-12-31']) result = pd.concat((result_eval['eval'], result)) result.index = result.index.map(lambda x: str(x)[:10]) result.columns = ['预测值'] print(result) -with pd.ExcelWriter(r'C:\Users\鸽子\Desktop\市区日电量预测_1228.xlsx', mode='a', if_sheet_exists='replace', +with pd.ExcelWriter(r'C:\Users\鸽子\Desktop\市区日电量预测_1229.xlsx', mode='a', if_sheet_exists='replace', engine='openpyxl') as writer: result.to_excel(writer, sheet_name='宁波') diff --git a/各地级市日电量模型/杭州.py b/各地级市日电量模型/杭州.py index 851979f..11dc3aa 100644 --- a/各地级市日电量模型/杭州.py +++ b/各地级市日电量模型/杭州.py @@ -86,20 +86,19 @@ print(result_eval) print('r2:', r2_score(y_test, y_pred)) X_eval = np.array([ - [14.9, 0.3, 0, 0, 1, 2023], - [14.3, 1.2, 0, 0, 1, 2023], - [10.6, 2.7, 0, 0, 1, 2023], - [17.2, 2.7, 0, 3, 1, 2023], - [10.7, 0.6, 0, 3, 1, 2023] + [13.8, 1.4, 0, 0, 1, 2023], + [10.1, 2.7, 0, 0, 1, 2023], + [15.3, 6.3, 0, 3, 1, 2023], + [12.2, 1.8, 0, 3, 1, 2023] ]) print(model.predict(X_eval)) result = model.predict(X_eval) -result = pd.DataFrame(result, index=['2023-12-27', '2023-12-28', '2023-12-29', '2023-12-30', '2023-12-31']) +result = pd.DataFrame(result, index=['2023-12-28', '2023-12-29', '2023-12-30', '2023-12-31']) result = pd.concat((result_eval['eval'], result)) result.index = result.index.map(lambda x: str(x)[:10]) result.columns = ['预测值'] print(result) -with pd.ExcelWriter(r'C:\Users\鸽子\Desktop\市区日电量预测_1228.xlsx', mode='a', if_sheet_exists='replace', +with pd.ExcelWriter(r'C:\Users\鸽子\Desktop\市区日电量预测_1229.xlsx', mode='a', if_sheet_exists='replace', engine='openpyxl') as writer: result.to_excel(writer, sheet_name='杭州') \ No newline at end of file diff --git a/各地级市日电量模型/温州.py b/各地级市日电量模型/温州.py index 68dfacf..3971b4b 100644 --- a/各地级市日电量模型/温州.py +++ b/各地级市日电量模型/温州.py @@ -83,20 +83,19 @@ print(result_eval) import numpy as np X_eval = np.array([ - [18, 3.3, 0, 0, 1, 2023], - [18.8, 8.2, 0, 0, 1, 2023], - [16.9, 11.2, 0, 0, 1, 2023], - [20.7, 11.6, 0, 3, 1, 2023], - [14.5, 3.3, 0, 3, 1, 2023] + [19.0, 7.1, 0, 0, 1, 2023], + [17.2, 8.2, 0, 0, 1, 2023], + [19.9, 11.0, 0, 3, 1, 2023], + [15.8, 4.2, 0, 3, 1, 2023] ]) print(model.predict(X_eval)) result = model.predict(X_eval) -result = pd.DataFrame(result, index=['2023-12-27', '2023-12-28', '2023-12-29', '2023-12-30', '2023-12-31']) +result = pd.DataFrame(result, index=['2023-12-28', '2023-12-29', '2023-12-30', '2023-12-31']) result = pd.concat((result_eval['eval'], result)) result.index = result.index.map(lambda x: str(x)[:10]) result.columns = ['预测值'] print(result) -with pd.ExcelWriter(r'C:\Users\鸽子\Desktop\市区日电量预测_1228.xlsx', mode='a', if_sheet_exists='replace', +with pd.ExcelWriter(r'C:\Users\鸽子\Desktop\市区日电量预测_1229.xlsx', mode='a', if_sheet_exists='replace', engine='openpyxl') as writer: result.to_excel(writer, sheet_name='温州') diff --git a/各地级市日电量模型/湖州.py b/各地级市日电量模型/湖州.py index e3e0075..889216a 100644 --- a/各地级市日电量模型/湖州.py +++ b/各地级市日电量模型/湖州.py @@ -83,21 +83,19 @@ print(result_eval) import numpy as np X_eval = np.array([ - - [12.9, 2.1, 0, 0, 1, 2023], - [11.7, 2.2, 0, 0, 1, 2023], - [8, 1.9, 0, 0, 1, 2023], - [13, 4.4, 0, 3, 1, 2023], - [9.7, 0.7, 0, 3, 1, 2023] + [10.6, 1.7, 0, 0, 1, 2023], + [9.1, 3.7, 0, 0, 1, 2023], + [11, 5.1, 0, 3, 1, 2023], + [11.0, 1.5, 0, 3, 1, 2023] ]) print(model.predict(X_eval)) result = model.predict(X_eval) -result = pd.DataFrame(result, index=['2023-12-27', '2023-12-28', '2023-12-29', '2023-12-30', '2023-12-31']) +result = pd.DataFrame(result, index=['2023-12-28', '2023-12-29', '2023-12-30', '2023-12-31']) result = pd.concat((result_eval['eval'], result)) result.index = result.index.map(lambda x: str(x)[:10]) result.columns = ['预测值'] print(result) -with pd.ExcelWriter(r'C:\Users\鸽子\Desktop\市区日电量预测_1228.xlsx', mode='a', if_sheet_exists='replace', +with pd.ExcelWriter(r'C:\Users\鸽子\Desktop\市区日电量预测_1229.xlsx', mode='a', if_sheet_exists='replace', engine='openpyxl') as writer: result.to_excel(writer, sheet_name='湖州') \ No newline at end of file diff --git a/各地级市日电量模型/绍兴.py b/各地级市日电量模型/绍兴.py index f97c39d..a8eac67 100644 --- a/各地级市日电量模型/绍兴.py +++ b/各地级市日电量模型/绍兴.py @@ -79,21 +79,19 @@ print(result_eval) import numpy as np X_eval = np.array([ - - [15.4, 0.1, 0, 0, 1, 2023], - [14.2, 3.5, 0, 0, 1, 2023], - [12.8, 4.6, 0, 0, 1, 2023], - [19.7, 5.2, 0, 3, 1, 2023], - [10.9, 0.8, 0, 3, 1, 2023] + [13.5, 3.2, 0, 0, 1, 2023], + [12.3, 4.2, 0, 0, 1, 2023], + [16.4, 6.2, 0, 3, 1, 2023], + [12.2, 2.1, 0, 3, 1, 2023] ]) print(model.predict(X_eval)) result = model.predict(X_eval) -result = pd.DataFrame(result, index=['2023-12-27', '2023-12-28', '2023-12-29', '2023-12-30', '2023-12-31']) +result = pd.DataFrame(result, index=['2023-12-28', '2023-12-29', '2023-12-30', '2023-12-31']) result = pd.concat((result_eval['eval'],result)) result.index = result.index.map(lambda x:str(x)[:10]) result.columns = ['预测值'] print(result) -with pd.ExcelWriter(r'C:\Users\鸽子\Desktop\市区日电量预测_1228.xlsx', mode='a', if_sheet_exists='replace', +with pd.ExcelWriter(r'C:\Users\鸽子\Desktop\市区日电量预测_1229.xlsx', mode='a', if_sheet_exists='replace', engine='openpyxl') as writer: result.to_excel(writer, sheet_name='绍兴') \ No newline at end of file diff --git a/各地级市日电量模型/舟山.py b/各地级市日电量模型/舟山.py index 1df8d35..b7163d3 100644 --- a/各地级市日电量模型/舟山.py +++ b/各地级市日电量模型/舟山.py @@ -74,20 +74,19 @@ print(result_eval) import numpy as np X_eval = np.array([ - [15.1, 8.2, 0, 0, 1, 2023], - [12.5, 8.5, 0, 0, 1, 2023], - [12, 8.0, 0, 0, 1, 2023], - [15.0, 10.0, 0, 3, 1, 2023], - [9.3, 5.9, 0, 3, 1, 2023] + [12.3, 8.4, 0, 0, 1, 2023], + [13.3, 7.9, 0, 0, 1, 2023], + [13.0, 10.6, 0, 3, 1, 2023], + [10.5, 6.1, 0, 3, 1, 2023] ]) print(model.predict(X_eval)) result = model.predict(X_eval) -result = pd.DataFrame(result, index=['2023-12-27', '2023-12-28', '2023-12-29', '2023-12-30', '2023-12-31']) +result = pd.DataFrame(result, index=['2023-12-28', '2023-12-29', '2023-12-30', '2023-12-31']) result = pd.concat((result_eval['eval'], result)) result.index = result.index.map(lambda x: str(x)[:10]) result.columns = ['预测值'] print(result) -with pd.ExcelWriter(r'C:\Users\鸽子\Desktop\市区日电量预测_1228.xlsx', mode='a', if_sheet_exists='replace', +with pd.ExcelWriter(r'C:\Users\鸽子\Desktop\市区日电量预测_1229.xlsx', mode='a', if_sheet_exists='replace', engine='openpyxl') as writer: result.to_excel(writer, sheet_name='舟山') diff --git a/各地级市日电量模型/衢州.py b/各地级市日电量模型/衢州.py index d061854..2f4ea8e 100644 --- a/各地级市日电量模型/衢州.py +++ b/各地级市日电量模型/衢州.py @@ -69,21 +69,20 @@ print(result_eval) import numpy as np X_eval = np.array([ - [15.0, 3.0, 0, 0, 1, 2023], - [15.7, 5.1, 0, 0, 1, 2023], - [15.2, 5.6, 0, 0, 1, 2023], - [17.9, 6.8, 0, 3, 1, 2023], - [12.0, 2.9, 0, 3, 1, 2023] + [15.7, 4.5, 0, 0, 1, 2023], + [16.0, 4.8, 0, 0, 1, 2023], + [17.0, 7.4, 0, 3, 1, 2023], + [12.9, 4.1, 0, 3, 1, 2023] ]) print(model.predict(X_eval)) result = model.predict(X_eval) -result = pd.DataFrame(result, index=['2023-12-27', '2023-12-28', '2023-12-29', '2023-12-30', '2023-12-31']) +result = pd.DataFrame(result, index=['2023-12-28', '2023-12-29', '2023-12-30', '2023-12-31']) result = pd.concat((result_eval['eval'],result)) result.index = result.index.map(lambda x:str(x)[:10]) result.columns = ['预测值'] print(result) -with pd.ExcelWriter(r'C:\Users\鸽子\Desktop\市区日电量预测_1228.xlsx', mode='a', if_sheet_exists='replace', +with pd.ExcelWriter(r'C:\Users\鸽子\Desktop\市区日电量预测_1229.xlsx', mode='a', if_sheet_exists='replace', engine='openpyxl') as writer: result.to_excel(writer, sheet_name='衢州') diff --git a/各地级市日电量模型/金华.py b/各地级市日电量模型/金华.py index 0a3fb16..581f38e 100644 --- a/各地级市日电量模型/金华.py +++ b/各地级市日电量模型/金华.py @@ -74,20 +74,19 @@ print(result_eval) import numpy as np X_eval = np.array([ - [16.3, 2.5, 0, 0, 1], - [16.9, 3.8, 0, 0, 1], - [16.5, 6.2, 0, 0, 1], - [18.8, 7.8, 0, 3, 1], - [12.5, 2.8, 0, 3, 1] + [16.8, 3.2, 0, 0, 1], + [17.2, 5.3, 0, 0, 1], + [17.2, 6.4, 0, 3, 1], + [13.9, 4.0, 0, 3, 1] ]) print(model.predict(X_eval)) result = model.predict(X_eval) -result = pd.DataFrame(result, index=['2023-12-27', '2023-12-28', '2023-12-29', '2023-12-30', '2023-12-31']) +result = pd.DataFrame(result, index=['2023-12-28', '2023-12-29', '2023-12-30', '2023-12-31']) result = pd.concat((result_eval['eval'],result)) result.index = result.index.map(lambda x:str(x)[:10]) result.columns = ['预测值'] print(result) -with pd.ExcelWriter(r'C:\Users\鸽子\Desktop\市区日电量预测_1228.xlsx', mode='a', if_sheet_exists='replace', +with pd.ExcelWriter(r'C:\Users\鸽子\Desktop\市区日电量预测_1229.xlsx', mode='a', if_sheet_exists='replace', engine='openpyxl') as writer: result.to_excel(writer, sheet_name='金华') \ No newline at end of file diff --git a/浙江电压等级电量/分压_移动平均.py b/浙江电压等级电量/分压_移动平均.py index e335f5b..1c90acc 100644 --- a/浙江电压等级电量/分压_移动平均.py +++ b/浙江电压等级电量/分压_移动平均.py @@ -1,6 +1,6 @@ import pandas as pd -df = pd.read_excel(r'C:\Users\鸽子\Desktop\zj20231228.xlsx', sheet_name=1) +df = pd.read_excel(r'C:\Users\鸽子\Desktop\20231229.xlsx', sheet_name=1) df['pt_date'] = pd.to_datetime(df['pt_date']) # 移动平均 @@ -21,7 +21,7 @@ for city in df['city_name'].drop_duplicates(): # index_level.append(level) df_moving_avg = pd.DataFrame(df_city1[level], index=df_city1.index) - future = pd.date_range(start='2023-12-27', periods=5, freq='D') + future = pd.date_range(start='2023-12-28', periods=4, freq='D') for date in future: df_moving_avg.loc[date, level] = df_moving_avg[-3:].mean().values @@ -38,7 +38,7 @@ for city in df['city_name'].drop_duplicates(): # index=index_level) # resut_df = pd.DataFrame({'预测电量': pred_list},index=index_level) - with pd.ExcelWriter(r'C:\Users\鸽子\Desktop\市分压电量预测_1228.xlsx', mode='a', if_sheet_exists='replace', + with pd.ExcelWriter(r'C:\Users\鸽子\Desktop\市分压电量预测_1229.xlsx', mode='a', if_sheet_exists='replace', engine='openpyxl') as writer: resut_df.to_excel(writer, sheet_name=f'{city[4:6]}') diff --git a/浙江行业电量/行业_移动平均.py b/浙江行业电量/行业_移动平均.py index a611ae7..d154dab 100644 --- a/浙江行业电量/行业_移动平均.py +++ b/浙江行业电量/行业_移动平均.py @@ -1,12 +1,11 @@ import pandas as pd -df = pd.read_excel(r'C:\Users\鸽子\Desktop\zj20231228.xlsx', sheet_name=2) +df = pd.read_excel(r'C:\Users\鸽子\Desktop\20231229.xlsx', sheet_name=2) df['stat_date'] = pd.to_datetime(df['stat_date']) # 移动平均 for city in df['city_name'].drop_duplicates(): - print(city) df_city = df[df['city_name'] == city].set_index('stat_date').loc['2023-12'].sort_index() dict_big = {} dict_ok = {} @@ -20,7 +19,7 @@ for city in df['city_name'].drop_duplicates(): for industry in df_city.columns[2:]: # index_industry.append(industry) df_moving_avg = pd.DataFrame(df_city[industry], index=df_city.index) - future = pd.date_range(start='2023-12-27', periods=5, freq='D') + future = pd.date_range(start='2023-12-28', periods=4, freq='D') for date in future: df_moving_avg.loc[date, industry] = df_moving_avg[-3:].mean().values @@ -32,7 +31,7 @@ for city in df['city_name'].drop_duplicates(): # pred_list.append(df_moving_avg[industry].sum()) # loss_list.append(df_city1[industry].sum()-df_moving_avg[industry].sum()) # rate_list.append((df_city1[industry].sum()-df_moving_avg[industry].sum())/df_city1[industry].sum()) - with pd.ExcelWriter(r'C:\Users\鸽子\Desktop\行业电量预测_1228.xlsx', mode='a', if_sheet_exists='replace', + with pd.ExcelWriter(r'C:\Users\鸽子\Desktop\行业电量预测_1229.xlsx', mode='a', if_sheet_exists='replace', engine='openpyxl') as writer: resut_df.to_excel(writer, sheet_name=f'{city[4:6]}')