Skip to content

Instantly share code, notes, and snippets.

@rwarbelow
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rwarbelow/9533533 to your computer and use it in GitHub Desktop.
Save rwarbelow/9533533 to your computer and use it in GitHub Desktop.
We took zip codes from a CSV file. We checked to see if the zip code was nil or less than five digits. If so, we fixed the zip code by adding 0s or putting "no zip code."
RegDate first_Name last_Name Email_Address HomePhone Street City State Zipcode
1 11/12/08 10:47 Allison Nguyen arannon@jumpstartlab.com 6154385000 3155 19th St NW Washington DC 20010
2 11/12/08 13:23 SArah Hankins pinalevitsky@jumpstartlab.com 414-520-5000 2022 15th Street NW Washington DC 20009
3 11/12/08 13:30 Sarah Xx lqrm4462@jumpstartlab.com (941)979-2000 4175 3rd Street North Saint Petersburg FL 33703
4 11/25/08 19:21 David Thomas gdlia.lepping@jumpstartlab.com 650-799-0000 9 garrison ave Jersey City NJ 7306
5 2/2/09 11:29 Chris Sackett fpmorgan07@jumpstartlab.com 613 565-4000 173 Daly Ave Ottawa ON
6 11/12/08 15:00 Aya Fuller jtex@jumpstartlab.com 778.232.7000 2-1325 Barclay Street Vancouver BC 90210
7 11/12/08 16:05 Mary Kate Curry wmppydaymaker@jumpstartlab.com (202) 328 1000 1509 Jackson Street Baltimore MD 21230
8 11/12/08 17:18 Audrey Hasegan ffbbieucf@jumpstartlab.com 530-919-3000 1570 Old Ranch Rd. Placerville CA 95667
9 11/13/08 1:32 Shiyu Armideo odfarg06@jumpstartlab.com 8084974000 644 Ikemaka PL Kailua HI 96734
10 11/13/08 16:40 Eli Zielke jbrabeth.buckley@jumpstartlab.com 858 405 3000 3024 Cranbrook Ct La Jolla CA 92037
11 11/13/08 18:17 Colin Harmston qkristie.lencsak@jumpstartlab.com 14018685000 34 blue heron drive attleboro MA 2703
12 11/13/08 21:19 Megan Doe wkganize@jumpstartlab.com 315.450.6000 64 King Ave Columbus OH 43201
13 11/16/08 11:44 Meggie Tippit dgsanshamel@jumpstartlab.com 510 282 4000 28 Olive Ave. Piedmont CA 94611
14 11/16/08 13:54 Laura Rapetsky ikr08@jumpstartlab.com 787-295-0000 Urb Monte Carlo c/15#1287 San Juan PR 924
15 11/16/08 20:20 Paul Fulghum cnroh@jumpstartlab.com 9.82E+00 shohadaye sadeghiye Tehran YK 14517
16 11/17/08 19:41 Shannon Warner gkjordandc@jumpstartlab.com (603) 305-3000 186 Crooked S Road Lyndeborough NH 3082
17 11/19/08 21:56 Shannon Davis ltb3@jumpstartlab.com 530-355-7000 Campion 1108 914 E. Jefferson Seattle WA 98122
18 11/20/08 16:25 Nash Okaty qdansonlm@jumpstartlab.com 206-226-3000 914 E Jefferson ST Seattle WA 98122
19 11/23/08 20:44 Amanda Hartzell nqm17@jumpstartlab.com 607-280-2000 3515 School St Valois NY 14841
require 'csv'
def fix_zipcode(zipcode)
if zipcode.nil?
zipcode = "No zipcode"
elsif zipcode.length < 5
zipcode = zipcode.rjust(5, "0")
end
puts zipcode
end
puts "EventManager Initialized!"
contents = CSV.open("event_attendees.csv", headers: true, header_converters: :symbol)
contents.each do |row|
zipcode = row[:zipcode]
fix_zipcode(zipcode)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment