Skip to content

Instantly share code, notes, and snippets.

@cpearce
Last active March 6, 2020 09:21
Show Gist options
  • Save cpearce/5ba33347ba15c4d795489712ba62497c to your computer and use it in GitHub Desktop.
Save cpearce/5ba33347ba15c4d795489712ba62497c to your computer and use it in GitHub Desktop.
CSV Reader Example
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