我想转换包含整数以及'yes'和'no'值的'edjefe'列的数据。我的问题是我只想将“是”和“否”映射到1和0,并保持int值不变,所以我写了这段代码
def foo(x):
if x == 'no':
return 0
elif x == 'yes':
return 1
else:
return x
和 df1.edjefe.map(lambda x : foo(x))
但是我遇到了一个错误,
RecursionError: maximum recursion depth exceeded while calling a Python object
米琪卡哇伊
牛魔王的故事
catspeake
相关分类