数据值是这样的Survivedage022.0138.0126.0135.0035.00null054.002.0127.0114.014.0158.0020.0039.0014.0155.002.01null031.01nullage_interval = [(lower, upper) for lower, upper in zip(range(0, 96, 5), range(5, 101, 5))]def age_partition(age):
""" 将年龄分类 """
for lower, upper in age_interval: if age is None: return "None"
elif lower <= age <= upper: return f"({lower}, {upper})"我想对age一列进行修改,比如把22.0改为(20, 30),把38改成(30, 40)上面的代码是对age值进行修改的函数我应该如何对age列进行修改呢?
添加回答
举报
0/150
提交
取消