def remove_outliers(table):
mx = max(map(max, table))
mn = min(map(min, table))
avg = (mx + mn) / 2
for row in table:
row[:] = [avg if x in (mx, mn) else x for x in row]
return table
def remove_outliers(table):
mx = max(map(max, table))
mn = min(map(min, table))
avg = (mx + mn) / 2
for row in table:
row[:] = [avg if x in (mx, mn) else x for x in row]
return table
我认为你的意图是错误的。它将在处理第一行后返回。试试这个:
return语句位于错误的位置。函数将在第一次迭代中退出。 在for循环外取消缩进返回语句。 然后,它将在完成迭代后退出
相关问题 更多 >
编程相关推荐