+1 vote
1 view
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


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

Ive also tried


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.5k 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:

Welcome to Intellipaat Community. Get your technical queries answered by top developers !