-1

I am running a csv file through a function that will normalize and standardize addresses. The function creates two csv files: one with a normalize addresses and an error csv file that contains addresses that cannot be normalized. Currently my input csv file runs only the address, city, state and zipcode, but I also want to include name of the business into the input csv file.

How do I add the name field so that it will import the information into the given output csv files? I want that the name appears in all given output files. For example :

Input has ALbert Golf Course, address Output should have Albert Golf Course, Normalized Address

Gonzalo68
  • 431
  • 4
  • 11
  • 22

1 Answers1

1

So your question is

How do I add the name field (...) ?

Define the row number:

address1    = 0
address2    = 1
city        = 2
...
business_name = 5

Then add to output:

except Exception, e:
    outputRow = row[business_name] + ",".join(row) + "," + str(e)+ "\n"
    ...

else:
    outputRow = row[business_name] + " " + verifiedAddress.address.address_line1 + ","
adrianus
  • 3,141
  • 1
  • 22
  • 41
  • what is lob in the python script ? – salil vishnu Kapur Jul 21 '15 at 09:09
  • Did you write the script yourself? [lob](https://github.com/lob/lob-python) seems to be a "python wrapper for the Lob.com API". – adrianus Jul 21 '15 at 09:16
  • As i learn from the posts on python from stack overflow, so was inquisitive as what exactly is this lob .Anyways thanks, but could you explain what do you mean by wrapper ? – salil vishnu Kapur Jul 21 '15 at 09:22
  • @salilvishnuKapur I'm sorry, I thought you were the one who posted the question :-) A wrapper is a piece of software which allows you to access code e.g. not natively written for that language, or for example accessing an API like an object. See also [Wikipedia](https://en.wikipedia.org/wiki/Wrapper_library). – adrianus Jul 21 '15 at 09:27
  • No I am modifying and testing it for my own research purposes. – Gonzalo68 Jul 21 '15 at 17:17