📜  python - 如果为 null 则连接 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:09.679000             🧑  作者: Mango

代码示例1
# Option 1
df['concat'] = np.where(df['var_1'] == '', df['var_2'], df['var_1'] + '_u')

# Option 2
def concat_fields(field1, field2):
        if field1.empty:
            return field2
        else:
            return field1 + '_u'