You can use where
and col
functions to do the same. where
will be used for filtering of data based on a condition (here it is, if a column is like '%string%'
). The col('col_name')
is used to represent the condition and like
is the operator:
df.where(col('col1').like("%string%")).show()