Browse Source

预测代码

罗俊辉 1 year ago
parent
commit
8a30eb17bf
1 changed files with 21 additions and 0 deletions
  1. 21 0
      p_data_process.py

+ 21 - 0
p_data_process.py

@@ -0,0 +1,21 @@
+"""
+生成预测数据,  3月14日 和 3月17日的小时级数据
+             3月18日至 3月21日的daily 数据
+"""
+import os
+import json
+from functions import generate_hourly_strings
+
+target_string_list = generate_hourly_strings(start_date="2024031400", end_date="2024031723")
+path = "temp_data/data"
+L = []
+for file in target_string_list:
+    json_path = os.path.join(path, file + ".json")
+    print(json_path)
+    with open(json_path, encoding="utf-8") as f:
+        data = json.loads(f.read())
+    for obj in data:
+        L.append(obj)
+
+with open("prid_data/train_0314_0317.json", "w", encoding="utf-8") as f:
+    f.write(json.dumps(L, ensure_ascii=False))