Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Challenge | Preprocessing Data: Part II
Data Manipulation using pandas

ChallengeChallenge

Let's replace the negative values in the 'empinch' and 'invsth' columns with zeros using the .where() method.

Task

  1. Select the 'empinch' and 'invsth' columns.
  2. Apply the .where() method to chosen columns.
  3. Set the condition what values must be replaced (these must be negative values). Remember, values that don't satisfy this condition will be replaced.
  4. Set the parameter what values must be used instead of replaced ones.

Everything was clear?

Section 2. Chapter 5
toggle bottom row
course content

Course Content

Data Manipulation using pandas

ChallengeChallenge

Let's replace the negative values in the 'empinch' and 'invsth' columns with zeros using the .where() method.

Task

  1. Select the 'empinch' and 'invsth' columns.
  2. Apply the .where() method to chosen columns.
  3. Set the condition what values must be replaced (these must be negative values). Remember, values that don't satisfy this condition will be replaced.
  4. Set the parameter what values must be used instead of replaced ones.

Everything was clear?

Section 2. Chapter 5
toggle bottom row
some-alt