I have a semicolon separated csv file which has the following form:
indx1; string1; char1; entry1
indx2; string1; char2; entry2
indx3; string2; char2; entry3
indx4; string1; char1; entry4
indx5; string3; char2; entry5
I want to get unique entries of the 1st and 2nd columns of this file in the form of a list (without using pandas or numpy). In particular these are the lists that I desire:
[string1, string2, string3]
[char1, char2]
The order doesn't matter, and I would like the operation to be fast.
Presently, I am reading the file (say 'data.csv') using the command
with open('data.csv') as csv_file:
csv_reader = csv.reader(csv_file, delimiter=';')
I am using python 2.7. What is the fastest way to achieve the functionality that I desire? I will appreciate any help.