Created
February 5, 2020 16:39
-
-
Save kyleparisi/678daf95c5d0306e97e05f47d57e915e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
import os | |
from types import SimpleNamespace | |
from utils.logging import logger | |
PROJECT_PATH = os.path.abspath(os.path.dirname(__name__)) | |
def run(): | |
logger.info(f"Reading CSV") | |
path = f"{PROJECT_PATH}/data.csv" | |
number_of_rows = len(open(path).readlines()) - 1 | |
with open(path, newline="") as csvfile: | |
rows = csv.DictReader(csvfile) | |
row_counter = 0 | |
logger.info(f"Processing {number_of_rows} rows") | |
for row in rows: | |
row_counter += 1 | |
logger.info(f"Processed {row_counter}/{number_of_rows} rows") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment