我有大约 30 列我希望更改一个值,如果该值在该行中的一列列表中。这有点难以口头描述,所以这里有一些我正在谈论的代码:
test = test.groupby('RealId')['Player'].apply(list).reset_index(name='Invalids')
test.index = te["RealId"]
test.drop("RealId", axis='columns', inplace=True)
test = test.join(te, on="RealId", how="left")
test['PA_14'].isin(test['Invalids'])
PA_14 列是一个普通的字符串 Series,而 Invalids 是一系列字符串列表。我想要的是最后一行输出一个布尔向量,但 isin() 似乎不适用于一系列列表。考虑到它需要再做 30 次,我如何相对快速地做到这一点?
拉莫斯之舞
相关分类