![]() |
VOOZH | about |
In this article, we are going to drop the rows with a specific value in pyspark dataframe.
Creating dataframe for demonstration:
Output:
👁 ImageMethod 1: Using where() function
This function is used to check the condition and give the results. That means it drops the rows based on the values in the dataframe column
Syntax: dataframe.where(condition)
Example 1: Python program to drop rows with college = vrs.
Output:
👁 ImageExample 2: Python program to drop rows with ID=1
Output:
👁 ImageMethod 2: Using filter() function
This function is used to check the condition and give the results, Which means it drops the rows based on the values in the dataframe column. Both are similar.
Syntax: dataframe.filter(condition)
Example: Python code to drop row with name = ravi.