Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lära Challenge: Masking Sensitive Data in DataFrames | Protecting Sensitive Data
Python Security Best Practices

bookChallenge: Masking Sensitive Data in DataFrames

Uppgift

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.

Lösning

Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 3. Kapitel 5
single

single

Fråga AI

expand

Fråga AI

ChatGPT

Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal

close

Awesome!

Completion rate improved to 5.56

bookChallenge: Masking Sensitive Data in DataFrames

Svep för att visa menyn

Uppgift

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.

Lösning

Switch to desktopByt till skrivbordet för praktisk övningFortsätt där du är med ett av alternativen nedan
Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 3. Kapitel 5
single

single

some-alt