Skip to content

Commit 38c8fe0

Browse files
committed
documenting reading numbers with leading zeros
1 parent fb69647 commit 38c8fe0

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

docs/data_transformations.md

+7
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ It removes any values which are `nil` or would be empty strings.
2626
`convert_values_to_numeric` is enabled by default.
2727
SmarterCSV will convert strings containing Integers or Floats to the appropriate class.
2828

29+
Here is an example of using `convert_values_to_numeric` for numbers with leading zeros, e.g. ZIP codes:
30+
31+
```
32+
data = SmarterCSV.process('/tmp/zip.csv', convert_values_to_numeric: { except: [:zip] })
33+
=> [{:zip=>"00480"}, {:zip=>"51903"}, {:zip=>"12354"}, {:zip=>"02343"}]
34+
```
35+
2936
## Remove Zero Values
3037
`remove_zero_values` is disabled by default.
3138
When enabled, it removes key/value pairs which have a numeric value equal to zero.

0 commit comments

Comments
 (0)