您好,我需要一个输出,其中有X个,其中每行都有一个列名,并且有一些丢失的数据,其他输出是y,根据每行的X,我们可以映射到其他excel工作表。我需要一个包含输出的新列,如下所示:
X =(df.apply(lambda x: list(x[x.isnull()].index),axis=1))
Colname=tuple X
def func1(row):
res = []
for i in row:
try:
res.append(df1.loc[df1['Category'] == i]["Questions"].iloc[0])
except:
res.append("Not Found")
return res
y = X.apply(lambda x : func1(x))
df['empty_field']:[
{'Colname':'unknown', "List_questions": y }
]
#Output which is needed
"empty_field": [
{
"One of the item form the column name list from X": "unknown",
"list_of_ques": [
Questions here
]
}
]