Skip to content
Snippets Groups Projects
Commit 7b7e154c authored by James D'Alton's avatar James D'Alton
Browse files

adjustments to data extraction script

parent fd50563b
No related branches found
No related tags found
No related merge requests found
import csv import csv
with open('demo.csv') as compliance_data: tableData = {}
with open('temp/test.csv') as compliance_data:
compliance_data_reader = csv.reader(compliance_data, delimiter=',') compliance_data_reader = csv.reader(compliance_data, delimiter=',')
line_count = 0 line_count = 0
for row in compliance_data_reader: for row in compliance_data_reader:
number_of_columns = row.size() number_of_columns = len(row)
if line_count == 0: if line_count == 0:
print(f'Column names are {" ".join(row)}') print(f'{" ".join(row)}')
line_count += 1 line_count += 1
else: else:
# row[1] is the 2nd column, not row # row[1] is the 2nd column, not row
print(f'{row[0]}\t{row[1]}\t{row[2]}') for column in row:
print(f'{column}')
tableData[row[0]] = row[1]
line_count += 1 line_count += 1
print(f'Processed {line_count} lines.') print(f'Done: Processed {line_count} lines.')
# for dataType in tableData:
# print(f'{dataType}\t{tableData.get(dataType)}')
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment