Bootstrap

数据分析~Python操作CSV数据文件

import csv


with open('/Users/apple/Downloads/lect01_codes/grades.csv') as csvfile:
    grades_data = list(csv.DictReader(csvfile))
# print(grades_data)
print('记录个数:', len(grades_data))
print('前2条记录:', grades_data[:2])

print('列名:', list(grades_data[0].keys())) 

===========

记录个数: 2315
前2条记录: [OrderedDict([('student_id', 'B73F2C11-70F0-E37D-8B10-1D20AFED50B1'), ('assignment1_grade', '92.73394641'), ('assignment1_submission', '55:34.3'), ('assignment2_grade&
;