Last active
April 13, 2019 13:50
-
-
Save sdorsett/1f5afe12e423540a54c0bfc87c0c36dd to your computer and use it in GitHub Desktop.
Bold Idea - python - csv import and parse data example
This file contains hidden or 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 | |
with open('~/Documents/github-projects/nflscrapR-data/games_data/regular_season/reg_games_2018.csv') as csv_file: | |
csv_reader = csv.reader(csv_file, delimiter=',') | |
line_count = 0 | |
for row in csv_reader: | |
if line_count == 0: | |
print(f'Column names are {", ".join(row)}') | |
line_count += 1 | |
else: | |
print(f'\t{row[2]} vs {row[3]} was {row[-2]} to {row[-1]}.') | |
line_count += 1 | |
print(f'Processed {line_count} lines.') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment