Pandasdrill

Level 2: Cleaning Exercise 14 of 45 Pro

Search text with str.contains

A pandas exercise from Pandasdrill. Solve it with a Python editor in your browser running real pandas, and it is checked the moment you submit.

The task

Return the rows of `products` whose `item` contains the word organic in any capitalization.

What this exercise teaches

str.contains returns True where the pattern appears. By default it is case sensitive, so "organic" would miss "Organic Apples" and "ORGANIC EGGS". case=False, or lowercasing first, catches every spelling.

A hint if you get stuck

str.contains has a case parameter. Setting it to False ignores capitalization.

This exercise is part of Pro

Pro unlocks all 45 exercises, with worked solutions and progress saved to your account. The free exercises work without an account.

You create a free account first, so Pro is attached to it.

Monthly is charged today and then every month until you cancel, in one click from your account page. Lifetime is one payment with no renewals. Full refund within 14 days of paying.

Start with the free exercises

More exercises in Cleaning