set index and loc pandas dataframe code example Example: df.loc a list of index df[df.index.isin([1,3])]