Skip to content

Commit

Permalink
documenting reading numbers with leading zeros
Browse files Browse the repository at this point in the history
  • Loading branch information
tilo committed Jul 22, 2024
1 parent fb69647 commit 38c8fe0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docs/data_transformations.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ It removes any values which are `nil` or would be empty strings.
`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"}]
```

## 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.
Expand Down

0 comments on commit 38c8fe0

Please sign in to comment.