Description
Generate Python/Pandas scripts for common data cleaning tasks. Handles missing values, duplicates, data type conversions, and standardization with reusable code patterns.
Preview
Example Input
Dataset issues: Names in mixed case, phone numbers in various formats, date column has multiple formats, some duplicate emails.
Example Output
## Python Data Cleaning Script\n\n```python\nimport pandas as pd\nimport re\nfrom dateutil import parser\n\ndef clean_dataset(df):\n # Standardize names (Title Case)\n df["name"] = df["name"].str.strip().str.title()\n \n # Standardize phone numbers\n def clean_phone(phone):\n if pd.isna(phone):\n return None\n digits = re.sub(r"\D", "", str(phone))\n if len(digits) == 10:\n return f"({digits[:3]}) {digits[3:6]}-{digits[6:]}"\n return phone\n \n df["phone"] = df["phone"].apply(clean_phone)\n \n # Parse mixed date formats\n def parse_date(date_str):\n try:\n return parser.parse(str(date_str))\n except:\n return None\n \n df["date"] = df["date"].apply(parse_date)\n \n # Remove duplicate emails (keep first)\n df = df.drop_duplicates(subset=["email"], keep="first")\n \n return df\n\n# Usage\ndf_clean = clean_dataset(df)\n```\n\n**Notes:**\n- Install: `pip install python-dateutil`\n- Handles most common edge cases\n- Preserves original data if parsing fails
Reviews (15)
This prompt understands data patterns. The insights are invaluable!
Nice prompt for data work. Good balance of depth and clarity.
Essential for data professionals. Saves hours of analysis work.
Essential for data professionals. Saves hours of analysis work.
This prompt delivers actionable insights. Highly recommended!
Game-changer for data analysis. The quality is consistently high!
Perfect for data interpretation. The analysis quality is remarkable.
Perfect for data interpretation. The analysis quality is remarkable.
This data analysis prompt is exceptional! Clear insights every time.
Fantastic for data storytelling. Clear visualizations and insights.
FREE with subscription
Learn More →- Instant download after purchase
- Lifetime access
- 30-day money-back guarantee
About the Seller
Mark-T AI
Member since Feb 15, 2025
Official Mark-T marketplace prompts. Curated collection of high-quality AI prompts for ChatGPT, Claude, Midjourney, DALL-E, Stable Diffusion, and Sora. Trusted by thousands of creators and professionals.