for循环遍历行创建字典

2022-04-08  本文已影响0人  Norahd
dict = {}
for index,row in df.iterrows():
      dict[index] = row["Col_A"]

df["Col_B"] = df.index.map(dict) #基于dict对index映射结果
上一篇 下一篇

猜你喜欢

热点阅读