Код: Выделить всё
mapper = {'a': 'b', 'c': nan, 'd': 'e', nan : nan}
df['b'] = [ mapper[x] for x in df['a'] ]
df['b'].value_counts()
Код: Выделить всё
NameError Traceback (most recent call last)
in ()
NameError: name 'nan' is not defined
Подробнее здесь: https://stackoverflow.com/questions/386 ... ot-defined
Мобильная версия