user15649753
user15649753

Reputation: 523

how to get a specific value of a column in pyspark?

I want all rows whose their value in column col1 is equal to yes. in pandas I can get like this

df[df['col1']=='yes']

how is it in pyspark?

Upvotes: 0

Views: 2306

Answers (1)

danielsepulvedab
danielsepulvedab

Reputation: 674

You can use the filter method from the DataFrame.

df.filter(df["col1"] == "yes")

or

df.filter("col1 == 'yes'")

Upvotes: 2

Related Questions