Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Replace Categorical Missing Data with Values | Data Cleaning
Preprocessing Data
course content

Contenido del Curso

Preprocessing Data

Preprocessing Data

1. Data Exploration
2. Data Cleaning
3. Data Validation
4. Normalization & Standardization
5. Data Encoding

Replace Categorical Missing Data with Values

To deal with categorical data:

  • replace with some constant or the most popular value
  • create a new category for these values. -process the data after converting it to the numerical. We'll use this approach later.

Let's explore for each column Cabin and Embarked(these columns contain NaNs) and figure out how to proceed with the NaNs.

Tarea

  1. Explore the share of NaNs for each of the given columns. Print these values.
  2. For Embarked column, simply drop the missing values, since there are only 2 rows containing it.
  3. For the Cabin, about 77% of data is missing (if everything is done correct). That's why we'll replace NaNs with some new value. To do that:
  • print all the unique values for the Cabin column.
  • choose any other vlaue except already presented in the Cabin column and replace all NaNs with it. (For example, it can be 'Z' or 'X').

Check some data samples to see the modified dataframe.

Tarea

  1. Explore the share of NaNs for each of the given columns. Print these values.
  2. For Embarked column, simply drop the missing values, since there are only 2 rows containing it.
  3. For the Cabin, about 77% of data is missing (if everything is done correct). That's why we'll replace NaNs with some new value. To do that:
  • print all the unique values for the Cabin column.
  • choose any other vlaue except already presented in the Cabin column and replace all NaNs with it. (For example, it can be 'Z' or 'X').

Check some data samples to see the modified dataframe.

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 5
toggle bottom row

Replace Categorical Missing Data with Values

To deal with categorical data:

  • replace with some constant or the most popular value
  • create a new category for these values. -process the data after converting it to the numerical. We'll use this approach later.

Let's explore for each column Cabin and Embarked(these columns contain NaNs) and figure out how to proceed with the NaNs.

Tarea

  1. Explore the share of NaNs for each of the given columns. Print these values.
  2. For Embarked column, simply drop the missing values, since there are only 2 rows containing it.
  3. For the Cabin, about 77% of data is missing (if everything is done correct). That's why we'll replace NaNs with some new value. To do that:
  • print all the unique values for the Cabin column.
  • choose any other vlaue except already presented in the Cabin column and replace all NaNs with it. (For example, it can be 'Z' or 'X').

Check some data samples to see the modified dataframe.

Tarea

  1. Explore the share of NaNs for each of the given columns. Print these values.
  2. For Embarked column, simply drop the missing values, since there are only 2 rows containing it.
  3. For the Cabin, about 77% of data is missing (if everything is done correct). That's why we'll replace NaNs with some new value. To do that:
  • print all the unique values for the Cabin column.
  • choose any other vlaue except already presented in the Cabin column and replace all NaNs with it. (For example, it can be 'Z' or 'X').

Check some data samples to see the modified dataframe.

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 5
toggle bottom row

Replace Categorical Missing Data with Values

To deal with categorical data:

  • replace with some constant or the most popular value
  • create a new category for these values. -process the data after converting it to the numerical. We'll use this approach later.

Let's explore for each column Cabin and Embarked(these columns contain NaNs) and figure out how to proceed with the NaNs.

Tarea

  1. Explore the share of NaNs for each of the given columns. Print these values.
  2. For Embarked column, simply drop the missing values, since there are only 2 rows containing it.
  3. For the Cabin, about 77% of data is missing (if everything is done correct). That's why we'll replace NaNs with some new value. To do that:
  • print all the unique values for the Cabin column.
  • choose any other vlaue except already presented in the Cabin column and replace all NaNs with it. (For example, it can be 'Z' or 'X').

Check some data samples to see the modified dataframe.

Tarea

  1. Explore the share of NaNs for each of the given columns. Print these values.
  2. For Embarked column, simply drop the missing values, since there are only 2 rows containing it.
  3. For the Cabin, about 77% of data is missing (if everything is done correct). That's why we'll replace NaNs with some new value. To do that:
  • print all the unique values for the Cabin column.
  • choose any other vlaue except already presented in the Cabin column and replace all NaNs with it. (For example, it can be 'Z' or 'X').

Check some data samples to see the modified dataframe.

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

¿Todo estuvo claro?

To deal with categorical data:

  • replace with some constant or the most popular value
  • create a new category for these values. -process the data after converting it to the numerical. We'll use this approach later.

Let's explore for each column Cabin and Embarked(these columns contain NaNs) and figure out how to proceed with the NaNs.

Tarea

  1. Explore the share of NaNs for each of the given columns. Print these values.
  2. For Embarked column, simply drop the missing values, since there are only 2 rows containing it.
  3. For the Cabin, about 77% of data is missing (if everything is done correct). That's why we'll replace NaNs with some new value. To do that:
  • print all the unique values for the Cabin column.
  • choose any other vlaue except already presented in the Cabin column and replace all NaNs with it. (For example, it can be 'Z' or 'X').

Check some data samples to see the modified dataframe.

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 5
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