Challenge: Masking Sensitive Data in DataFrames
Swipe to start coding
Write a function that takes a pandas DataFrame and a list of sensitive column names, and returns a new DataFrame where all values in those sensitive columns are replaced with the string "MASKED". This helps prevent accidental exposure of sensitive data when displaying or sharing DataFrames.
- The function must return a copy of the original DataFrame with the specified columns masked.
- If a column in the sensitive list does not exist in the DataFrame, it must be ignored.
- Non-sensitive columns must remain unchanged.
Solução
Obrigado pelo seu feedback!
single
Pergunte à IA
Pergunte à IA
Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo
Can you explain this in simpler terms?
What are the main takeaways from this?
Can you give me an example?
Awesome!
Completion rate improved to 5.56
Challenge: Masking Sensitive Data in DataFrames
Deslize para mostrar o menu
Swipe to start coding
Write a function that takes a pandas DataFrame and a list of sensitive column names, and returns a new DataFrame where all values in those sensitive columns are replaced with the string "MASKED". This helps prevent accidental exposure of sensitive data when displaying or sharing DataFrames.
- The function must return a copy of the original DataFrame with the specified columns masked.
- If a column in the sensitive list does not exist in the DataFrame, it must be ignored.
- Non-sensitive columns must remain unchanged.
Solução
Obrigado pelo seu feedback!
single