vega / datalib

JavaScript data utility library.
http://vega.github.io/datalib/
BSD 3-Clause "New" or "Revised" License
731 stars 133 forks source link

Optionally ignore certain values when inferring types #84

Closed yngve-sk closed 7 years ago

yngve-sk commented 7 years ago

The type inference got messed up by some "?" values in a dataset. Being able to (optionally) pass a regex to infer / inferAll and thus ignore certain values can solve problems like this.

Example

// Ignore any sequence of "?" entries
let typesIgnore = datalib.type.inferAll(data, data.columns, /^[ ?]*[?][ ?]*$/);
// Ignore nothing
let types = datalib.type.inferAll(data, data.columns);

Results: screen shot 2017-06-10 at 2 54 20 pm

jheer commented 7 years ago

Thanks! This is a useful feature to add.