Last active
November 9, 2015 00:46
-
-
Save mthipparthi/2f19f3718f16d546491b to your computer and use it in GitHub Desktop.
Python : Finding Unique Eements in a column
This file contains 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
# Best way to find uniqness in python is to apply set to any python datastructure | |
asin_list=[] | |
with open('3984875016745.txt') as input_file: | |
for line in input_file.readlines(): | |
asin_list.append(list(line.split('\t'))[16]) | |
asin_list.remove('asin1') | |
with open('asin_output.txt','w') as out_file: | |
for asin in list(set(asin_list)): | |
out_file.write(asin+'\n') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment