Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2022 11:26 PM
Hi,
Getting the not duplicated records and doing 'left_anti' join should do the trick.
not_duplicate_records = df.groupBy(primary_key).count().where('count = 1').drop('count')
duplicate_records = df.join(not_duplicate_records, on=primary_key, how='left_anti').show()