SpinTheMic
Pro

Interview practice question

Removing duplicate records from a list

Data Engineering · Python · Beginner

You have a list of dictionaries from an API, and some records are duplicated by id. How do you keep only the latest version of each?

What a strong answer covers

Your AI report card counts how many of these ideas you cover.

  • Use a dict keyed by id to keep one record per key.
  • Keep the record with the latest updated_at.
  • In pandas, sort by updated_at and drop_duplicates on id keeping last.
  • Preserve order if needed.
  • Log how many duplicates were removed.
Practise this topic

Start without signing up. Sign in free to get an AI report card on your answer.

See all topics