Skip to content

Instantly share code, notes, and snippets.

@tylerpearson
Last active September 11, 2015 20:46
Show Gist options
  • Select an option

  • Save tylerpearson/6ae36c983e0fe1fcd24c to your computer and use it in GitHub Desktop.

Select an option

Save tylerpearson/6ae36c983e0fe1fcd24c to your computer and use it in GitHub Desktop.
require 'csv'
yc_companies_names = []
def simple_name(name)
name.downcase
end
# mattermark export
CSV.foreach("mattermark.csv") { |row| yc_companies_names << simple_name(row[0]) }
CSV.open('results.csv', 'w') do |csv|
csv << "Location ID,Business Account Number,Ownership Name,DBA Name,Street Address,City,State,Zip Code,Business Start Date,Business End Date,Location Start Date,Location End Date,Mail Address,Mail City State Zip,Class Code,PBC Code,Business Location".split(',')
# CSV from https://data.sfgov.org/Economy-and-Community/Registered-Business-Locations-San-Francisco/g8m3-pdis
CSV.foreach("business-locations.csv", headers: true) do |row|
dba_name = row['DBA Name']
simple_name = simple_name(dba_name)
if yc_companies_names.include?(simple_name)
csv.puts row
puts "#{simple_name} matches"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment