I have a dataframe and a list as follows.
         id     title     description
0  17810732  "nn nn."  "nnnn nnnn"
1  17810731  "mm mm."  "mmmm mmmm"
2  17810739  "ll ll."  "llll llll"
3  17810738  "jj jj."  "jjjj jjjj"
ids = [17810738, 17810731]
I want to get a dataframe that only has rows corresponding to the ids list.
So my output should be as follows.
         id     title     description
0  17810738  "jj jj."  "jjjj jjjj"
1  17810731  "mm mm."  "mmmm mmmm"
I have been using this code.
for id in ids:
   print(df.loc[df["id"] == id])
However, it only returns seperate dataframes to each id, which is not what I need.
I am happy to provide more details if needed.
 
    