Legacy Code Refactoring
About this result
Transform spaghetti code into something you're proud of. Get clean, fast, documented code — plus learn what made the old version slow.
ChatGPT Prompt
Act as a Senior Python Engineer. Refactor the provided legacy code block.
Context:
- The current code is slow and hard to read.
- It processes large CSV files sequentially.
- Target environment: Python 3.12.
Requirements:
- Implement vectorization using Pandas where possible.
- Add type hinting (PEP 484).
- Add docstrings following the Google style guide.
- Handle 'FileNotFound' and 'EmptyData' exceptions gracefully.
Code to refactor: [PASTE CODE HERE]
Output format:
- The refactored code block.
- A bulleted list of the performance improvements made.
#development#python#code-quality
Was this prompt helpful?
5
people found this useful
Z
zoe_prompt
Shared Dec 8, 2025
Explore More Prompts
Have a great prompt to share?
Submit Your Prompt