Explore Courses Blog Tutorials Interview Questions
+1 vote
in Big Data Hadoop & Spark by (1k points)

I want to select a column that equals to a certain value. I am doing this in scala and having a little trouble.

Heres my code"state")==="TX").show()

this returns the state column with boolean values instead of just TX

Ive also tried"state")=="TX").show() 

but this doesn't work either.


2 Answers

+1 vote
by (13.2k points)
selected by
Best answer

You can use dataframe.filter(condition)

For your code, the condition will be df(“state”) === “TX” ,


0 votes
by (32.3k points)
edited by

I solved the same problem using the syntax below:


If you want to know more about Scala, then do check out this awesome video tutorial:

Browse Categories