Last active
March 6, 2020 09:21
-
-
Save cpearce/5ba33347ba15c4d795489712ba62497c to your computer and use it in GitHub Desktop.
CSV Reader Example
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 | |
def csv_lines(csv_path_name): | |
with open(csv_path_name) as csv_file: | |
reader = csv.reader(csv_file) | |
for row in reader: | |
# Drop empty values | |
yield [value for value in row if value] | |
csv_data = [row for row in csv_lines("armpy/datasets/BMS-POS.csv")] | |
print(csv_data[:5]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment