0

I'm looking for help for this problem.

Given this a dataframe like this:

| A   | B            |
| 0   | Blue apple   |
| 1   | White banana |
| 2   | Red banana   |
| 3   | Red apple    |

I have to find the row indexes of rows where I have 'Red' in column 1.

In SQL I would do something like

SELECT A
FROM df
WHERE B LIKE 'Red%'

For Pandas, I googled a bit but only found partial solutions with == operator, I couldn't find anything for a "like". Then I have to collect the row indexes in a list, the result would be like [2, 3].

Can someone help me? Thanks!

0 Answers0