Before you start data pre-processing.....
Unless you’re getting your data as an export from a well-maintained database, CSV files can be full of unpleasant surprises: inconsistencies, empty fields/rows/columns, duplicated headers, extra spaces, superfluous or missing quotation marks, and other morsels of havoc….. In the best case scenario, your code will crash or generate errors when encountering unexpected input. But if your data pipeline doesn’t break, artifacts can be published into production and troubleshooting the root cause can be complex and time-consuming (don’t ask me how I know 🙃).
I ran across this reddit post discussing a script that intentionally generates such artifacts:
Ugly CSV Generator: Stress-Test Your Data Pipelines with Real-World Ugliness!
Here is the author’s GitHub: Ugly CSV Generator
This phenomenon isn’t unique to machine learning; however, dealing with dirty data is something we will all need to deal with eventually in real-world scenarios, and it’s worth putting some thought into programmatic solutions.
The author states that he is working on automation that would deal with bad input, but it’s still a work in progress.
We are the target audience for this project. In the author’s words: "if you write data pipelines that start from documents that should be CSVs, but you really cannot trust who is making this data, and therefore the need to test that your data pipeline can make up for some of this madness or at the very least fail gracefully.”