🚀 LEVEL UP TO SENIOR:Unlock 500+ Advanced Practical Challenges & Expert Masterclasses.
🎓 COURSERA PARTNER:Earn professional Google, Meta, and IBM certificates to supercharge your resume.
REFERENCEpandas

pandas Documentation

📖 INDEX

No matches found.
LOADING ENGINE...

Series.str.contains()

AI & DATA SCIENCE // series-str-contains

Test if pattern or regex is contained within a string of a Series or Index.

Syntax

mask = df['name'].str.contains('keyword', na=False)

Examples

Example 01Basic Usage
mask = df['name'].str.contains('keyword', na=False)

Best Practices

  • Use vectorized operations over iterations (e.g. iterrows()) for performance.
  • Always verify memory usage when loading large files.