Skip to content

Commit

Permalink
Create a normalize function
Browse files Browse the repository at this point in the history
  • Loading branch information
amymok committed Jan 3, 2018
1 parent 6ec8e15 commit 6a152a7
Showing 1 changed file with 8 additions and 5 deletions.
Expand Up @@ -5,6 +5,9 @@
class Command(BaseCommand):
args = "<filename>"

def normalize(s):
return s.strip().upper()

def handle(self, *args, **options):
branch_location_filename = args[0]
count = 0;
Expand All @@ -14,11 +17,11 @@ def handle(self, *args, **options):
for branch_location_line in branch_location_reader:
record = Branch(
year = branch_location_line[0].replace("'", ""),
name = branch_location_line[6].strip().upper(),
street = branch_location_line[7].strip().upper() if branch_location_line[7] != '0' else '',
city = branch_location_line[8].strip().upper(),
state = branch_location_line[10].strip().upper(),
zipcode = branch_location_line[11].strip(),
name = normalize(branch_location_line[6]),
street = normalize(branch_location_line[7]) if branch_location_line[7] != '0' else '',
city = normalize(branch_location_line[8]),
state = normalize(branch_location_line[10]),
zipcode = normalize(branch_location_line[11]),
lat = branch_location_line[13],
lon = branch_location_line[12],
)
Expand Down

0 comments on commit 6a152a7

Please sign in to comment.