重排SA标签的索引,从1开始并命名,同时按开始时间排序

This commit is contained in:
marques
2025-07-25 16:50:19 +08:00
parent 0109eb5703
commit 08bcbb4b28

View File

@ -335,6 +335,11 @@ class Data:
for key, raw in self.raw.items():
DataFrame(raw.reshape(-1)).to_csv(Path(Config["Path"]["SaveFolder"]) / Path((Config["ChannelSave"][key] + str(self.freq[key]) + Config["EndWith"][key])),
index=False, header=False)
# 重排index从1开始并给index命名
self.SALabel.reset_index(drop=True, inplace=True)
self.SALabel.index = self.SALabel.index + 1
self.SALabel.index.name = "Index"
self.SALabel.sort_values(by=["Start"], inplace=True)
self.SALabel.to_csv(Path(Config["Path"]["SaveFolder"]) / Path((Config["LabelSave"]["SA Label"] + Config["EndWith"]["SA Label"])),
encoding="gbk")
except PermissionError as e: