Filtering rows that does not contain a string
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2020 03:23 AM
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2020 10:34 AM
Here is a complete example
values = [("K1","true","false"),("K2","true","false")]
columns = ['Key', 'V1', 'V2']
df = spark.createDataFrame(values, columns)
display(df)
FILTER
df2 = df.filter(df.column2 != "delete")
display(df2)
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2020 10:35 AM
OOps
Copy and past error, the First code block should be,
values = [("save","save"),("save", "delete")]
columns = ['column1','column2']
df = spark.createDataFrame(values, columns)
display(df)

