📜  python if column is null then - Python 代码示例

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

代码示例1
df['real_lastName'] = np.where(df['LastName'].isnull(), df['Middle'], df['LastName'] )

print (df)
  FirstName Middle LastName real_lastName
0       Tom     Ju      NaN            Ju
1      Kity    NaN      Rob           Rob