populatetools / csvzip Goto Github PK
View Code? Open in Web Editor NEWA standalone CLI tool to reduce CSVs size by converting categorical columns in a list of unique integers.
License: MIT License
A standalone CLI tool to reduce CSVs size by converting categorical columns in a list of unique integers.
License: MIT License
Love the idea.
Just a quick suggestion. In the example you end up with a JSON mapping like
{
"census": {
"DESC_DISTRITO": {
"CENTRO": "0",
"ARGANZUELA": "1",
"RETIRO": "2",
"SALAMANCA": "3",
...
},
"DESC_BARRIO": {
"PALACIO": "0",
"EMBAJADORES": "1",
"UNIVERSIDAD": "2",
"CHOPERA": "3",
"PACIFICO": "4",
...
}
}
}
If I were using this I'd probably generate a lookup table for each key of census, so any lookups would be one operation, instead of traversing object keys and checking the values for a match.
Basically, flip them this way.
{
"census": {
"DESC_DISTRITO": {
"0": "CENTRO",
"1": "ARGANZUELA",
...
},
...
}
Let's say we're looping over the rows, or we're looking at the info for a single row.
const row = "139,1".split(','); // Fake row with two columns
This would always be fast
const name = mapping['census']['DESC_DISTRITO'][row[1]];
With the current mapping, lookups would get slower with the number of keys in the DESC_DISTRITO
object
Maybe I'm overlooking/missing something.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.