examples/round/README.md
# round
Round all values in a column.
```ruby
require 'datamix'
using DataMix
sp500 = file '../_data/sp500.csv'
# Option 1, call #round on the data table
sp500.keep :date, :open, :close, :volume
sp500.round :close, decimals: 2
sp500.round :volume
# Option 2, call #round on the column
sp500[:open] = sp500[:open].round 1
sp500.preview
```
# Output
```
+------------+--------+---------+------------+
| date | open | close | volume |
+------------+--------+---------+------------+
| 2015-03-11 | 2044.7 | 2040.24 | 3406570000 |
| 2015-03-12 | 2041.1 | 2065.95 | 3405860000 |
| 2015-03-13 | 2064.6 | 2053.4 | 3498560000 |
| 2015-03-16 | 2055.4 | 2081.19 | 3295600000 |
| 2015-03-17 | 2080.6 | 2074.28 | 3221840000 |
| 2015-03-18 | 2072.8 | 2099.5 | 4128210000 |
| 2015-03-19 | 2098.7 | 2089.27 | 3305220000 |
| 2015-03-20 | 2090.3 | 2108.1 | 5554120000 |
| 2015-03-23 | 2108.0 | 2104.42 | 3267960000 |
| 2015-03-24 | 2103.9 | 2091.5 | 3189820000 |
+------------+--------+---------+------------+
```