I want to solve a issue WITHOUT a for-loop.
I have a a list keys which contains multiple strings. In the example 2 but inreality multiple hundreds. And I want to select all rows of df for which the value of df["a]" is included in keys.
keys = ["z","x"]
df =pd.DataFrame({"a": ["z", "y", "x"],
              "b": [15,85,23]})
I could write a for-loop which check for every row whether df.a.iloc[i] in keys but ther must be a way to directly index this.
So what I am looking for is something along the lines of
df[df.a in keys]
which does not work.
