Hello problem to loop over a column by searching a list of word then create a Boolean column if any of the list word searched is found. Here is my code
# Code naf related to sport.
code = ["3230Z","4764Z","7721Z","8551Z","9311Z", "9312Z", "9313Z", "9319Z",
"9329Z", "364Z" "524W", "714B", "804C", "926A", "926C", "930L", "927C",
"923K"]
# check keywords of code into "Code_Naf" column
for branch in code:
df_codeNaf["topNAF"] = df_codeNaf["Code_NAF"].str.contains("3230Z" or "4764Z" or "7721Z" or "8551Z"
or "9311Z" or "9312Z" or "9313Z" or "9319Z"
or "9329Z" or "364Z" "524W" or "714B" or
"804C" or "926A" or "926C" or "930L" or
"927C" or "923K")
When I look in the topNaf column I found only 2 True but in reality there more than two. What's wrong with my code? Thanks