misoproject / dataset

JavaScript library that makes managing the data behind client-side visualisations easy
http://misoproject.com
GNU General Public License v2.0
1.18k stars 99 forks source link

Uncaught incorrect value 'X' of type string passed to column 'Y with type number #214

Open protobi opened 11 years ago

protobi commented 11 years ago

Is there an option to tell the Miso Dataset CSV parser to look at all the values before determining that a column should be of type other than String?

The CSV parser can be brittle in practice for general datasets, not looking far enough down to detect the row types and then unforgiving about type mismatches, failing with a hard error.

I keep running into errors of the form "Uncaught incorrect value 'X' of type string passed to column 'Y with type number". This happens in cases where

Many stats packages look at the first 100 rows by default, and have an option to scan more or even all rows before assessing column type.

* Update * I see builder.js line 23 has the code, so I just need to find a way to parameterize the 5: var type = _.inject(data.slice(0, 5), function(memo, value) {

Created a quick patch to always scan all the values. Since a type mismatch is a fatal error, seems more appropriate to make a complete scan the default, and make a partial scan an option.

https://github.com/gradualstudent/dataset/tree/master/dist