📌  相关文章
📜  pandas 将数据从一列复制到另一列 - Python 代码示例

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

代码示例1
df = pd.DataFrame()

df['X'] = [0, 3, 1, 1, 2, 2, 3, 3, 1, 2]
df['Y'] = [111.0, np.nan, np.nan, 112, 113, np.nan, 114, 115, np.nan, 116]

df['Y'] = df['Y'].fillna(df['X'])

print(df)