input data frame(input data have duplicates with some columns ,wants to delete previous data)
CodePudding user response:
According to your input and output I think you want to remove duplicate rows:
cols = ['col1', 'col2']
df_output = df_input.drop_duplicates(cols, keep='last')
You'll have to specify which columns to use, I'm not sure from your example which columns define duplicates