这是一个DataFrame
我的工作:熊猫计算逻辑或基于多个列
{'[email protected]': ['AAA', nan, nan],
'[email protected]': [nan, 'BBB', nan],
'[email protected]': [nan, nan, 'CCC'],
'[email protected]':[1,nan,nan],
'[email protected]':[nan,2,nan],
'[email protected]':[nan,nan, 3]
}
我想创建一个Recipe
列,其中将包括基于行的值不NaN
配方。 例如,第一行的值将是AAA
,第二行 - BBB
等。在DF中还有其他列,但Recipe
列应仅考虑到上述3个列。
因此,每行中总是只有一个非nan值,并且您希望在新列中使用该值? – itzy
这是正确的。谢谢 – Felix
你可以在这个例子中使用'df.max()',但你可能正在寻找一个更通用的解决方案。 – itzy