I am trying to do something pretty simple in Pandas but having trouble figuring out the cleanest way to do it.
I have a dataframe with a list of entities - they have names, IDs, prices, and other descriptive information. An example is below.
I would like to be able to first filter this dataframe based on a selection of a subset of IDs. In other words, if X=0, Y=1, and Z=1, I would like to only include entries with IDs Y or Z. Therefore, my output would only have the Jerry and Ben rows in the output.
I'm trying this form but am having trouble linking the binary variables for each ID to the string characters.
Any suggestions? Thank you for your help.
'''User input'''
X=0
Y=0
Z=0
ID_list=[X,Y,Z]
for ID in ID_list:
for entity in so_df:
if ID_list[i]=1 and so_df.iloc[entity]['ID']=???