Skip to content

Instantly share code, notes, and snippets.

@mthipparthi
Last active November 9, 2015 00:46
Show Gist options
  • Save mthipparthi/2f19f3718f16d546491b to your computer and use it in GitHub Desktop.
Save mthipparthi/2f19f3718f16d546491b to your computer and use it in GitHub Desktop.
Python : Finding Unique Eements in a column
# 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