-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathretype.py
More file actions
39 lines (28 loc) · 1.33 KB
/
retype.py
File metadata and controls
39 lines (28 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import unicodecsv
def read_csv(filename):
with open(filename, 'rb') as f:
reader = unicodecsv.DictReader(f)
return list(reader)
enrollments = read_csv('F:\\data\\DAND\\csv\\enrollments.csv')
daily_engagement = read_csv('F:\\data\\DAND\\csv\\daily_engagement.csv')
project_submissions = read_csv('F:\\data\\DAND\\csv\\project_submissions.csv')
print (enrollments[0])
print (daily_engagement[0])
print (project_submissions[0])
### For each of these three tables, find the number of rows in the table and
### the number of unique students in the table. To find the number of unique
### students, you might want to create a set of the account keys in each table.
def account_num(files):
num = set()
for file in files:
num.add(file['account_key'])
return len(num)
enrollment_num_rows = len(enrollments) # Replace this with your code
enrollment_num_unique_students = set() # Replace this with your code
for enrollment in enrollments:
enrollment_num_unique_students.add(enrollment['account_key'])
len(enrollment_num_unique_students)
engagement_num_rows = 0 # Replace this with your code
engagement_num_unique_students = 0 # Replace this with your code
submission_num_rows = 0 # Replace this with your code
submission_num_unique_students = 0 # Replace this with your code