I have a table that looks like that:
+---------+-------------+--------------+-----------+--------+--------------+--------------+
| cust_num|valid_from_dt|valid_until_dt|cust_row_id| cust_id|insert_load_dt|update_load_dt|
+---------+-------------+--------------+-----------+--------+--------------+--------------+
|950379405| 2018-08-24| 2018-08-24| 06885247|06885247| 2018-08-24| 2018-08-25|
|950379405| 2018-08-25| 2018-08-28| 06885247|06885247| 2018-08-25| 2018-08-29|
|950379405| 2018-08-29| 2019-12-16| 27344328|06885247| 2018-08-29| 2019-12-17|<- pair 1
|950379405| 2018-08-29| 2019-12-16| 27344328|06885247| 2018-08-29| |<- pair 1
|950379405| 2019-12-17| 2019-12-24| 91778710|06885247| 2019-12-17| |<- pair 2
|950379405| 2019-12-17| 2019-12-24| 91778710|06885247| 2019-12-17| 2019-12-25|<- pair 2
|950379405| 2019-12-25| 2019-12-25| 08396180|06885247| 2019-12-25| 2019-12-26|<- pair 3
|950379405| 2019-12-25| 2019-12-25| 08396180|06885247| 2019-12-25| |<- pair 3
As you can see I have some duplicated rows in my table and they are only different regarding update_load_dt being empty or with a date.
I would like to drop duplicates in my dataframe in such a way:
cable_dv_customer_fixed.dropDuplicates(['cust_num',
'valid_from_dt',
'valid_until_dt',
'cust_row_id',
'cust_id'])
but I would like to keep the row with more information.
By that I mean I would like to keep the row where update_load_dt <> ''
Is it possible to modify dropduplicates() function so that I can choose which row from duplicates to choose? or is there some other (better) way to do this?