251029更新

This commit is contained in:
marslbr 2025-10-29 18:02:40 +08:00
parent af5b539529
commit 376d8448a7
1 changed files with 47 additions and 37 deletions

View File

@ -12,13 +12,15 @@ import pandas
from utils.pandas_extension import save_as_workbook
print("正在清洗阿里云日志...", end="")
# 清洗后数据
data_processed = []
try:
print("正在清洗阿里云日志...", end="")
# 打开阿里云日志(将文件对象作为迭代器)
with open("log.csv", "r", encoding="utf-8") as file:
# 清洗后数据
data_processed = []
# 打开阿里云日志(将文件对象作为迭代器)
with open("log.csv", "r", encoding="utf-8") as file:
records = csv.DictReader(file)
for record in records:
# noinspection PyDictCreation
@ -55,9 +57,17 @@ with open("log.csv", "r", encoding="utf-8") as file:
data_processed.append(data)
dataset = pandas.DataFrame(data=data_processed)
dataset = pandas.DataFrame(data=data_processed)
print("已完成")
print("已完成")
except FileNotFoundError:
print("未找到阿里云日志文件,脚本终止")
exit()
except Exception as exception:
print(f"发生异常 {exception},脚本终止")
exit()
print("正在保存为工作簿...", end="")