Created
October 18, 2013 09:30
-
-
Save phihag/7039021 to your computer and use it in GitHub Desktop.
Demonstration of csv sorting
This file contains hidden or 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
text | text | text | 11/03/12 | text | text | text | UniqueNameClass1 | text | text | |
---|---|---|---|---|---|---|---|---|---|---|
text | text | text | 11/03/12 | text | text | text | UniqueNameClass1 | text | text | |
text | text | text | 11/03/12 | text | text | text | UniqueNameClass1 | text | text | |
text | text | text | 11/03/12 | text | text | text | UniqueNameClass1 | text | text | |
text | text | text | 11/03/12 | text | text | text | UniqueNameClass2 | text | text | |
text | text | text | 11/03/12 | text | text | text | UniqueNameClass2 | text | text | |
text | text | text | 11/03/12 | text | text | text | UniqueNameClass3 | text | text | |
text | text | text | 11/03/12 | text | text | text | UniqueNameClass4 | text | text | |
text | text | text | 11/03/12 | text | text | text | UniqueNameClass5 | text | text | |
text | text | text | 12/03/12 | text | text | text | UniqueNameClass3 | text | text | |
text | text | text | 12/03/12 | text | text | text | UniqueNameClass3 | text | text | |
text | text | text | 12/03/12 | text | text | text | UniqueNameClass4 | text | text | |
text | text | text | 12/03/12 | text | text | text | UniqueNameClass4 | text | text | |
text | text | text | 12/03/12 | text | text | text | UniqueNameClass4 | text | text | |
text | text | text | 12/03/12 | text | text | text | UniqueNameClass5 | text | text | |
text | text | text | 12/03/12 | text | text | text | UniqueNameClass5 | text | text | |
text | text | text | 12/03/12 | text | text | text | UniqueNameClass5 | text | text | |
text | text | text | 12/03/12 | text | text | text | UniqueNameClass5 | text | text | |
text | text | text | 13/03/12 | text | text | text | UniqueNameClass1 | text | text | |
text | text | text | 13/03/12 | text | text | text | UniqueNameClass2 | text | text | |
text | text | text | 13/03/12 | text | text | text | UniqueNameClass2 | text | text | |
text | text | text | 13/03/12 | text | text | text | UniqueNameClass2 | text | text | |
text | text | text | 13/03/12 | text | text | text | UniqueNameClass3 | text | text | |
text | text | text | 13/03/12 | text | text | text | UniqueNameClass4 | text | text | |
text | text | text | 13/03/12 | text | text | text | UniqueNameClass5 | text | text |
This file contains hidden or 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
text | text | text | 11/03/12 | text | text | text | UniqueNameClass1 | text | text | |
---|---|---|---|---|---|---|---|---|---|---|
text | text | text | 11/03/12 | text | text | text | UniqueNameClass2 | text | text | |
text | text | text | 11/03/12 | text | text | text | UniqueNameClass4 | text | text | |
text | text | text | 11/03/12 | text | text | text | UniqueNameClass3 | text | text | |
text | text | text | 11/03/12 | text | text | text | UniqueNameClass1 | text | text | |
text | text | text | 11/03/12 | text | text | text | UniqueNameClass2 | text | text | |
text | text | text | 11/03/12 | text | text | text | UniqueNameClass5 | text | text | |
text | text | text | 11/03/12 | text | text | text | UniqueNameClass1 | text | text | |
text | text | text | 11/03/12 | text | text | text | UniqueNameClass1 | text | text | |
text | text | text | 12/03/12 | text | text | text | UniqueNameClass5 | text | text | |
text | text | text | 12/03/12 | text | text | text | UniqueNameClass3 | text | text | |
text | text | text | 12/03/12 | text | text | text | UniqueNameClass4 | text | text | |
text | text | text | 12/03/12 | text | text | text | UniqueNameClass5 | text | text | |
text | text | text | 12/03/12 | text | text | text | UniqueNameClass5 | text | text | |
text | text | text | 12/03/12 | text | text | text | UniqueNameClass3 | text | text | |
text | text | text | 12/03/12 | text | text | text | UniqueNameClass5 | text | text | |
text | text | text | 12/03/12 | text | text | text | UniqueNameClass4 | text | text | |
text | text | text | 12/03/12 | text | text | text | UniqueNameClass4 | text | text | |
text | text | text | 13/03/12 | text | text | text | UniqueNameClass5 | text | text | |
text | text | text | 13/03/12 | text | text | text | UniqueNameClass4 | text | text | |
text | text | text | 13/03/12 | text | text | text | UniqueNameClass2 | text | text | |
text | text | text | 13/03/12 | text | text | text | UniqueNameClass1 | text | text | |
text | text | text | 13/03/12 | text | text | text | UniqueNameClass3 | text | text | |
text | text | text | 13/03/12 | text | text | text | UniqueNameClass2 | text | text | |
text | text | text | 13/03/12 | text | text | text | UniqueNameClass2 | text | text |
This file contains hidden or 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 | |
with open('RawDataeDataTest.csv', 'rb') as csvf: | |
data = list(csv.reader(csvf)) | |
data.sort(key=lambda row: (row[3], row[7])) | |
print(u'\n'.join(u','.join(row) for row in data)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment