1.pandas 两列取最小值,如果其中一列为nan, 会取另外一列
>>> df3 a b c 0 1 1 1.0 1 1 1 2.0 2 1 1 2.0 3 2 2 NaN 4 3 2 NaN >>> df3['d'] = df3[['a', 'c']].min(axis=1) >>> df3 a b c d 0 1 1 1.0 1.0 1 1 1 2.0 1.0 2 1 1 2.0 1.0 3 2 2 NaN 2.0 4 3 2 NaN 3.0 >>>