【发布时间】:2021-04-09 15:19:40
【问题描述】:
我有一个熊猫数据框,它由两列值组成。某些值丢失了,我想创建第三列来标记两列中是否缺少值或是否已填充。我不确定如何执行此操作,因为我是新手,您能提供的任何帮助将不胜感激
#input
df = {'First': ['','','A','B','B','C'],
'Second': ['12', '', '10', '', '', '11']}
df = pd.DataFrame(data = d)
#Possible output of third column
df['Third'] = ['Secondfilled', 'missing', 'bothfilled', 'Firstfilled', 'Firstfilled', bothfilled']
【问题讨论】:
标签: python pandas compare missing-data