Using String Accessor (.str) Methods in Pandas
📖 Scenario: You work in a small company that keeps a list of customer names and their email addresses. You want to clean and analyze the email addresses to find which ones are from a specific domain.
🎯 Goal: Build a small program that creates a DataFrame with customer names and emails, sets a domain to filter, uses string accessor methods to find emails from that domain, and prints the filtered list.
📋 What You'll Learn
Create a pandas DataFrame with exact customer names and emails
Create a variable for the email domain to filter
Use the pandas string accessor
.str with endswith() to filter emails by domainPrint the filtered DataFrame showing only customers with emails from the specified domain
💡 Why This Matters
🌍 Real World
Cleaning and filtering email lists is common in marketing and customer management to target specific groups.
💼 Career
Data analysts often use string accessor methods in pandas to clean and analyze text data efficiently.
Progress0 / 4 steps