Created
September 24, 2021 07:01
-
-
Save SaraM92/8fdb45b818c7a550cafe53ea171e47e2 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 | |
csv_mapping_list = [] | |
with open("/path/to/data.csv") as my_data: | |
csv_reader = csv.reader(my_data, delimiter=",") | |
line_count = 0 | |
for line in csv_reader: | |
if line_count == 0: | |
header = line | |
else: | |
row_dict = {key: value for key, value in zip(header, line)} | |
csv_mapping_list.append(row_dict) | |
line_count += 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment