shape: (7, 1)
| All_Students |
|---|
| str |
| "Serena" |
| "Dan" |
| "Blair" |
| "Chuck" |
| "Nate" |
| "Jenny" |
| "Raina" |
anti join
Joram Mutenge
2025-11-20
Polars provides a special type of join that lets you retrieve items in dataframe 1 that do not have a match in dataframe 2. This works like set difference in mathematics.
\[ \text{set A} - \text{set B} \]
Below are two dataframes to be joined.
df1
| All_Students |
|---|
| str |
| "Serena" |
| "Dan" |
| "Blair" |
| "Chuck" |
| "Nate" |
| "Jenny" |
| "Raina" |
df2
| Passed_Exam |
|---|
| str |
| "Dan" |
| "Raina" |
| "Blair" |
| "Jenny" |
To retrieve the names of students who failed the exam from the complete list of students, use the Polars join method as follows.
| All_Students |
|---|
| str |
| "Serena" |
| "Chuck" |
| "Nate" |
Enroll in my Polars course to learn advanced topics.