Automated Data Wrangling
catalyst.coop
catalyst.coop
https://github.com/capitalone/DataProfiler
We’re working to automate much of that as well in a Python library.
The end goal is to:
1. point at any dataset and load it with one command
2. Calculate statistics and identify entities with one command
3. Generate robust reports with one command.
Regarding the data wrangling... Believe it or not, even automatically detecting a delimited file with a header is hard work. Imagine a header can be on the 3rd row and has a title and author ship one rows 1 and 2 respectively. Further, the delimiter might be the “@“ symbol!
The linked library wrote handles that scenario. But that’s just CSVs, there’s also Json, parquet, Avro, etc etc...
This is an extraordinarily deep and complex field.
Thanks a lot for sharing!
I do want some flexibiliy though, for example, if a certain column is filled with 9 digit numbers, starting with 0 then treat it as string.
Will have a look at it, thanks for the link!
SSIS will generate a schema for a CSV file and then let you modify any column you choose (including what you described). All it does, really, is generate the schema that the “SQL Server bulk copy” tool interprets.
It’s standard Microsoft. You can do a million things with it and it can be integrated into the entire Windows ecosystem, but go too far and you are locked in. PS, the version control experience is bad. Really bad.
For casual use, by all means use it. It’s powerful and high performance. For real production use, perhaps try to find something else.
-delimiters
-quoting
-text encoding
-line endings
-headers
When you add in XML, JSON, fixed width etc is gets complicated fast.
So you can never guarantee to infer the data structure automatically. We just make the best guess we can and then allow the user to change those guesses and see the result in real time.
You can use a 'summary' transform to quickly summarize the data (e.g. number of blank values, min, max, numbers, dates etc).
People always think that the hard part of automated data wrangling is things like delimiters and headers, but the real hard part of automated data wrangling is when people who aren't data wranglers themselves are making the data or when the rules or apparatus for filling cells are even the slightest bit flexible because people will always find a way to mess with you.
If counting the instances of a particular string is all you need to do (and it quite often is) then de facto all data is "clean", as you can get the job done with grep. If, on the other hand, you require a relational database with strict primary and foreign key definitions and NULL limitations, then you're gonna have to put a lot more work into scrubbing.
Added to that, the more stringent the defition of "clean" you're working with, the more you're going to have to deal with trade-offs. E.g. what do you do with missing required data field values? Loosen the requirement? Add defaults? Dump those rows? And what do you do with data that makes no sense, e.g. where end dates come before start dates? What if you need to anonymize the data to meet data privacy requirements? Is rounding dates to the nearest month or year fine, or will it render the data useless?
There are recurrent problems, and recurrent solutions, and the author is absolutely right to say that more open source work should be done in that area. But due to complexity and inconsistency of the definitions of "clean" and "dirty", we will unfortunately never get to the point where we just feed some library the path to an arbitrary dirty data directory, press enter, go off to grab a coffee and come back to find our freshly cleaned data waiting for us.
-It would only work in a narrow domain.
-How do you know if you can trust the results?
2. The data is dirty. We need to clean it up.
3. Lets clean it up using machine learning!
4. Goto 1.
It's machine learning all the way down...
And wouldn't they just do in it Excel instead, probably with even worse results?
Website, for any interested: http://trymito.io/
Automated data prep/transformation is definitely a useful solution, and obviously is going to be a part of most data wrangling tools in the future. I think the danger is a lack of visibility and tracing, something a combo between spreadsheets and pandas provides well -- I think :)
Maybe I'm wrong - I have yet to do a deep dive on what data firefox indexes when I bookmark things.
Oh Excel ... I don't even know where to start.
It is my favourite university spinout story here on this side of the pond.