Python Pandas


Hi Codecademy,

I am working through the Inner Merge III with Python, specifically the exercise with Cool T-Shirts. Here is the question:

Cool T-Shirts Inc. thinks that they have more revenue in months where they sell more women’s t-shirts.

Select the rows of all_data where:

revenue is greater than target


women is greater than men

Save your answer to the variable results

I have two proposals of which neither works:

  1. results = all_data[all_data.revenue > and all_data.women >]

  2. results = all_data[all_data.revenue >] and all_data[all_data.women >]

Could you please give me a nudge in the right direction?




Hi @ericsokolowski ,

Use the & operator instead of and. Within the square brackets, you need to place parentheses around each of the two comparisons that serve as the operands of the & operator, as follows …

results = all_data[(all_data.revenue > & (all_data.women >]