-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcsv_reader.py
23 lines (18 loc) · 863 Bytes
/
csv_reader.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from consts import *
from utils import *
import csv
class csvReader():
def __init__(self, file, **parameters):
self.file = file
self.parameters = parameters
def row_filter(self,row, columns=['long', 'lat', 'banco', 'red', 'ubicacion', 'terminales', 'calle', 'altura']):
if row['localidad'] == 'CABA':
return {col: row[col] for col in columns}
def process_csv(self, data_dict):
with open(self.file, 'r') as csvfile:
atms_data = csv.DictReader(csvfile)
for row in atms_data:
transactions = 0
key = (float(row['long']),float(row['lat']),map_atm_code(row['red']))
values = [row['id'],row['red'],row['banco'],row['ubicacion'],row['terminales'],row['calle'],row['altura'],row['long'],row['lat']]
data_dict[key] = values