Skip to content
Advertisement

How to get unique values/elements of a column?

I am trying to get the unique values of a column from a tab. The values are repeated and the file has 1,000+ lines, I just want to have the names of the values, not all, and the ones that are repeated. I’m working on my code, but when I do “RUN” it generates the separate and random letters of the values (see example in ‘Output’ below). I hope someone can help me find my mistake. Please and thank you very much!

Code:

JavaScript

Output:

JavaScript

And so on…

DESIRED OUTPUT:

JavaScript

EX. FILE

JavaScript

Advertisement

Answer

If order doesn’t matter, you could do it by creating a set from the items in column 2 of the lines in the file:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement