docs/data_transformations.md in smarter_csv-1.12.1 vs docs/data_transformations.md in smarter_csv-1.13.0

- old
+ new

@@ -24,10 +24,19 @@ ## Convert Values to Numeric `convert_values_to_numeric` is enabled by default. SmarterCSV will convert strings containing Integers or Floats to the appropriate class. +Here is an example of using `convert_values_to_numeric` for numbers with leading zeros, e.g. ZIP codes: + +``` + data = SmarterCSV.process('/tmp/zip.csv', convert_values_to_numeric: { except: [:zip] }) + => [{:zip=>"00480"}, {:zip=>"51903"}, {:zip=>"12354"}, {:zip=>"02343"}] +``` + +This will return the column `:zip` as a string with all digits intact. + ## Remove Zero Values `remove_zero_values` is disabled by default. When enabled, it removes key/value pairs which have a numeric value equal to zero. ## Remove Values Matching @@ -42,9 +51,9 @@ It can happen that after all transformations, a row of the CSV file would produce a completely empty hash. By default SmarterCSV uses `remove_empty_hashes: true` to remove these empty hashes from the result. -This can be set to `true`, to keep these empty hashes in the results. +This can be set to `false`, to keep these empty hashes in the results. ------------------- PREVIOUS: [Header Validations](./header_validations.md) | NEXT: [Value Converters](./value_converters.md)