But filter also allows you to pass a regex, so you could also filter only those rows where the column entry ends with ball. In this case you use In this case you use df.set_index('ids').filter(regex='ball$', axis=0) vals ids aball 1 bball 2 fball 4 More @Wikipedia
Hover over any link to get a description of the article. Please note that search keywords are sometimes hidden within the full article and don't appear in the description or title.