How do you ensure you never mutate the raw source data during the cleaning process?

Quick Overview

Asks how you keep raw source data unchanged while cleaning it, both in pandas code and in the storage layer. Tests your grasp of copies versus views, side effects in helper functions, read-only raw zones, and ways to verify that the source was not altered.

How do you ensure you never mutate the raw source data during the cleaning process?

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: easy

Interview Round: Other

How do you ensure you never mutate the raw source data during the cleaning process? Answer at two levels: the code you write in a notebook or script, and the storage and pipeline that hold the data. ```hint Think about how mutation sneaks in List the ways a pandas or NumPy operation can change an object you did not mean to touch, then ask how you would prove after a run that the raw data is unchanged. ``` ### What a Strong Answer Covers - Code habits that avoid in-place changes, including how functions can mutate the frame they are given - How views and copies behave in pandas and NumPy, and where `.copy()` is and is not enough - Storage and permission controls that make the raw layer read-only, with cleaned output in a separate location - A way to verify that raw data was not changed, such as checksums or a test - The costs of keeping raw data immutable (memory, storage, required deletions) ### Follow-up Questions - A function you call is supposed to be pure but your raw frame changed after calling it. How do you find out why? - How would you handle a legal request to delete one user's records from a raw layer that is meant to be immutable? - What does pandas Copy-on-Write change about the risk of accidental mutation? - How do you make a cleaning step safe to rerun from raw without producing duplicate output?

Overview: Asks how you keep raw source data unchanged while cleaning it, both in pandas code and in the storage layer. Tests your grasp of copies versus views, side effects in helper functions, read-only raw zones, and ways to verify that the source was not altered.

General logo
General
Nov 24, 2026
easyData ScientistOtherData Manipulation (SQL/Python)
0
0

How do you ensure you never mutate the raw source data during the cleaning process?

Answer at two levels: the code you write in a notebook or script, and the storage and pipeline that hold the data.

What a Strong Answer Covers Guidance

  • Code habits that avoid in-place changes, including how functions can mutate the frame they are given
  • How views and copies behave in pandas and NumPy, and where .copy() is and is not enough
  • Storage and permission controls that make the raw layer read-only, with cleaned output in a separate location
  • A way to verify that raw data was not changed, such as checksums or a test
  • The costs of keeping raw data immutable (memory, storage, required deletions)

Follow-up Questions Guidance

  • A function you call is supposed to be pure but your raw frame changed after calling it. How do you find out why?
  • How would you handle a legal request to delete one user's records from a raw layer that is meant to be immutable?
  • What does pandas Copy-on-Write change about the risk of accidental mutation?
  • How do you make a cleaning step safe to rerun from raw without producing duplicate output?