DannyBen/datamix

View on GitHub
examples/delete_empty_rows/README.md

Summary

Maintainability
Test Coverage
# delete_empty_rows

Delete all rows that have one or more empty or `nil` values.

```ruby
require 'datamix'
using DataMix

sp500 = file '../_data/empties.csv'

puts "\nBefore:"
sp500.preview

sp500.delete_empty_rows

puts "\nAfter:"
sp500.preview

```

# Output

```
Before:
+------------+-------+
| date       | price |
+------------+-------+
| 2015-03-11 |       |
| 2015-03-12 |       |
| 2015-03-13 |       |
| 2015-03-16 | 2055  |
| 2015-03-17 | 2080  |
| 2015-03-18 | 2072  |
| 2015-03-19 | 2098  |
| 2015-03-20 | 2090  |
| 2015-03-23 | 2107  |
| 2015-03-24 | 2103  |
+------------+-------+

After:
+------------+-------+
| date       | price |
+------------+-------+
| 2015-03-16 | 2055  |
| 2015-03-17 | 2080  |
| 2015-03-18 | 2072  |
| 2015-03-19 | 2098  |
| 2015-03-20 | 2090  |
| 2015-03-23 | 2107  |
| 2015-03-24 | 2103  |
| 2015-03-25 | 2093  |
| 2015-03-26 | 2059  |
| 2015-03-27 | 2055  |
+------------+-------+
```