Created
December 17, 2013 03:03
-
-
Save plusplus/7999310 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# number of rows in the file | |
results.size | |
# => 105293 | |
# number of unique stock ids | |
results.map {|l| l[:stock_unique_id]}.uniq.size | |
# => 95067 | |
# number of stocked lines | |
stocked_ids = Set.new(results.select {|l| l[:stocked] == '1'}.map {|l| l[:stock_unique_id]}) | |
stocked_ids.size | |
# => 26649 | |
# number of unstocked lines | |
unstocked_ids = Set.new(results.select {|l| l[:stocked] == '0'}.map {|l| l[:stock_unique_id]}) | |
unstocked_ids.size | |
# => 68418 | |
# no stock ids have both stocked and unstocked lines | |
stocked_ids.intersection(unstocked_ids).size | |
# => 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment