Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Removing and Replacing | Preprocessing Data: Part II
Analyzing and Visualizing Real-World Data
course content

Contenido del Curso

Analyzing and Visualizing Real-World Data

Analyzing and Visualizing Real-World Data

1. Preprocessing Data: Part I
2. Preprocessing Data: Part II
3. Analyzing Data
4. Visualizing Data

Removing and Replacing

As mentioned previously, there are two ways to perform removing or replacing operations. Since we used the .str accessor two chapters ago, let's use a lambda function this time.

Tarea

  1. Define a lambda function with a single argument x that will:
    • Remove the '$' characters starting from the left (using the .lstrip() method);
    • Replace all blank spaces (' ') with empty strings ('') (using the .replace() method);
    • Assign the function to the rmv_rpl variable.
  2. Apply the rmv_rpl function to the 'Weekly_Sales' column using the .apply() method and convert it to the float data type.

Tarea

  1. Define a lambda function with a single argument x that will:
    • Remove the '$' characters starting from the left (using the .lstrip() method);
    • Replace all blank spaces (' ') with empty strings ('') (using the .replace() method);
    • Assign the function to the rmv_rpl variable.
  2. Apply the rmv_rpl function to the 'Weekly_Sales' column using the .apply() method and convert it to the float data type.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones

¿Todo estuvo claro?

Sección 2. Capítulo 2
toggle bottom row

Removing and Replacing

As mentioned previously, there are two ways to perform removing or replacing operations. Since we used the .str accessor two chapters ago, let's use a lambda function this time.

Tarea

  1. Define a lambda function with a single argument x that will:
    • Remove the '$' characters starting from the left (using the .lstrip() method);
    • Replace all blank spaces (' ') with empty strings ('') (using the .replace() method);
    • Assign the function to the rmv_rpl variable.
  2. Apply the rmv_rpl function to the 'Weekly_Sales' column using the .apply() method and convert it to the float data type.

Tarea

  1. Define a lambda function with a single argument x that will:
    • Remove the '$' characters starting from the left (using the .lstrip() method);
    • Replace all blank spaces (' ') with empty strings ('') (using the .replace() method);
    • Assign the function to the rmv_rpl variable.
  2. Apply the rmv_rpl function to the 'Weekly_Sales' column using the .apply() method and convert it to the float data type.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones

¿Todo estuvo claro?

Sección 2. Capítulo 2
toggle bottom row

Removing and Replacing

As mentioned previously, there are two ways to perform removing or replacing operations. Since we used the .str accessor two chapters ago, let's use a lambda function this time.

Tarea

  1. Define a lambda function with a single argument x that will:
    • Remove the '$' characters starting from the left (using the .lstrip() method);
    • Replace all blank spaces (' ') with empty strings ('') (using the .replace() method);
    • Assign the function to the rmv_rpl variable.
  2. Apply the rmv_rpl function to the 'Weekly_Sales' column using the .apply() method and convert it to the float data type.

Tarea

  1. Define a lambda function with a single argument x that will:
    • Remove the '$' characters starting from the left (using the .lstrip() method);
    • Replace all blank spaces (' ') with empty strings ('') (using the .replace() method);
    • Assign the function to the rmv_rpl variable.
  2. Apply the rmv_rpl function to the 'Weekly_Sales' column using the .apply() method and convert it to the float data type.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones

¿Todo estuvo claro?

As mentioned previously, there are two ways to perform removing or replacing operations. Since we used the .str accessor two chapters ago, let's use a lambda function this time.

Tarea

  1. Define a lambda function with a single argument x that will:
    • Remove the '$' characters starting from the left (using the .lstrip() method);
    • Replace all blank spaces (' ') with empty strings ('') (using the .replace() method);
    • Assign the function to the rmv_rpl variable.
  2. Apply the rmv_rpl function to the 'Weekly_Sales' column using the .apply() method and convert it to the float data type.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
Sección 2. Capítulo 2
Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
We're sorry to hear that something went wrong. What happened?
some-alt