251029更新
This commit is contained in:
parent
af5b539529
commit
376d8448a7
|
|
@ -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="")
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue