AHC task (3) Read CSV as a dictionary

Use DictReader to read csv as a dictionary

DictReader.py


import csv
data = []

with open('stimuliSet.csv', encoding = 'utf-8_sig') as f:
   reader = csv.DictReader(f)
   
   for row in reader:
      data.append(row)

Recommended Posts

AHC task (3) Read CSV as a dictionary
AHC task (1) Reading CSV file
Download Pandas DataFrame as a CSV file
How to read a CSV file with Python 2/3
Read JSON with Python and output as CSV
AHC task (2) append
Output the output result of sklearn.metrics.classification_report as a CSV file
2 ways to read all csv files in a folder
Read CSV file: pandas
Read Python csv file
[Python] Use JSON format data as a dictionary type object