1、增加新列,或更改某列的值
2、处理某列
例子如下:
根据列title的是否包含特定词,来赋值给新的列1或0的值
bugInfo['IntegrationTest'] = bugInfo.apply(lambda x: self.bug_rule(x, "IntegrationTest"), axis = 1) def bug_rule(self, frame, type): # 处理列表中的数据,更新到sql数据库中 result = "0" if type == "SmokeTest": # 冒烟测试 if re.search("^\[冒烟\]|\[冒烟测试\]|【冒烟】|【冒烟测试】", frame["title"]): result = "1" elif type == "InterfaceTest": # 接口测试 if re.search("^\[接口\]|\[接口测试\]|【接口】|【接口测试】", frame["title"]): result = "1" elif type == "IntegrationTest": # 集成测试 if self.IntegrationTime != "" and self.IntegrationTime == frame["created_time"]: result = "1" return result