p_data_process.py 677 B

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