forked from mneedham/neo4j-subtypes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
explore.rb
40 lines (35 loc) · 883 Bytes
/
explore.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
require 'smarter_csv'
require 'csv'
CSV.open("data/dogs.csv", "wb") do |csv|
csv << ["BreedGroup",
"PrimaryBreed",
"TagIdentity",
"PrimaryColour",
"YearsOld",
"MonthsOld",
"Location",
"Size"]
end
count = 0
CSV.open("data/dogs.csv", "ab") do |csv|
CSV.foreach("data/Animal_Tag_DATA.csv", headers:true) do |row|
next unless row['animal_type'] == "DOG"
next if row["tag_identity"].nil?
p row
csv << [row["breed_group"],
row["primary_breed"],
row["tag_identity"],
row["primary_color"],
row["years_old"],
row["months_old"],
row["location"],
row["animal_size"]
]
count = count+1
exit if count > 100
end
end
#
# rows = SmarterCSV.process('data/Animal_Tag_DATA.csv', {:row_sep => "\n"})
#
# p rows