-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSeparateDataset.py
27 lines (25 loc) · 911 Bytes
/
SeparateDataset.py
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
import csv
with open('fer2013.csv') as csvfile:
readCSV = csv.reader(csvfile, delimiter = ',')
with open('FER2013-Training.csv', 'w') as Training:
a = csv.writer(Training)
for row in readCSV:
if (row[2] == 'Training'):
del row[2]
a.writerow(row)
with open('fer2013.csv') as csvfile:
readCSV = csv.reader(csvfile, delimiter = ',')
with open('FER2013-Validation.csv', 'w') as Validation:
a = csv.writer(Validation)
for row in readCSV:
if (row[2] == 'PublicTest'):
del row[2]
a.writerow(row)
with open('fer2013.csv') as csvfile:
readCSV = csv.reader(csvfile, delimiter = ',')
with open('FER2013-Testing.csv', 'w') as Testing:
a = csv.writer(Testing)
for row in readCSV:
if (row[2] == 'PrivateTest'):
del row[2]
a.writerow(row)