Зміст курсу
Data Manipulation using pandas
Data Manipulation using pandas
2. Preprocessing Data: Part II
Challenge
You've solved the first problem with wrong column type. Let's solve the remaining one (with dots). Recall that there are 4 columns with wrong types left ('morgh', 'valueh', 'grosrth', 'omphtotinch'
). These columns considered to have dots as indicators for 'Not applicable'. For instance, columns valueh
and grosrth
are mutually exclusive, since the first one indicates the price of dwelling (i.e., house is owned) and the second one indicates the monthly rent.
The most appropriate way to solve this problem is to replace dots by NA
values. In that case, we would be able to manipulate column like a numerical one.
Завдання
Perform a replacement of dot symbols .
by NA
s for 'morgh', 'valueh', 'grosrth', 'omphtotinch'
columns. Follow the next steps:
- Import the
NumPy
library withnp
alias. - Apply the
.where()
method to thedf
dataframe. - Set the condition what values must remain unchanged. These must be non-dots values.
- Set the
other
parameter tonan
value fromNumPy
.
Завдання
Perform a replacement of dot symbols .
by NA
s for 'morgh', 'valueh', 'grosrth', 'omphtotinch'
columns. Follow the next steps:
- Import the
NumPy
library withnp
alias. - Apply the
.where()
method to thedf
dataframe. - Set the condition what values must remain unchanged. These must be non-dots values.
- Set the
other
parameter tonan
value fromNumPy
.
Все було зрозуміло?
Challenge
You've solved the first problem with wrong column type. Let's solve the remaining one (with dots). Recall that there are 4 columns with wrong types left ('morgh', 'valueh', 'grosrth', 'omphtotinch'
). These columns considered to have dots as indicators for 'Not applicable'. For instance, columns valueh
and grosrth
are mutually exclusive, since the first one indicates the price of dwelling (i.e., house is owned) and the second one indicates the monthly rent.
The most appropriate way to solve this problem is to replace dots by NA
values. In that case, we would be able to manipulate column like a numerical one.
Завдання
Perform a replacement of dot symbols .
by NA
s for 'morgh', 'valueh', 'grosrth', 'omphtotinch'
columns. Follow the next steps:
- Import the
NumPy
library withnp
alias. - Apply the
.where()
method to thedf
dataframe. - Set the condition what values must remain unchanged. These must be non-dots values.
- Set the
other
parameter tonan
value fromNumPy
.
Завдання
Perform a replacement of dot symbols .
by NA
s for 'morgh', 'valueh', 'grosrth', 'omphtotinch'
columns. Follow the next steps:
- Import the
NumPy
library withnp
alias. - Apply the
.where()
method to thedf
dataframe. - Set the condition what values must remain unchanged. These must be non-dots values.
- Set the
other
parameter tonan
value fromNumPy
.
Все було зрозуміло?
Challenge
You've solved the first problem with wrong column type. Let's solve the remaining one (with dots). Recall that there are 4 columns with wrong types left ('morgh', 'valueh', 'grosrth', 'omphtotinch'
). These columns considered to have dots as indicators for 'Not applicable'. For instance, columns valueh
and grosrth
are mutually exclusive, since the first one indicates the price of dwelling (i.e., house is owned) and the second one indicates the monthly rent.
The most appropriate way to solve this problem is to replace dots by NA
values. In that case, we would be able to manipulate column like a numerical one.
Завдання
Perform a replacement of dot symbols .
by NA
s for 'morgh', 'valueh', 'grosrth', 'omphtotinch'
columns. Follow the next steps:
- Import the
NumPy
library withnp
alias. - Apply the
.where()
method to thedf
dataframe. - Set the condition what values must remain unchanged. These must be non-dots values.
- Set the
other
parameter tonan
value fromNumPy
.
Завдання
Perform a replacement of dot symbols .
by NA
s for 'morgh', 'valueh', 'grosrth', 'omphtotinch'
columns. Follow the next steps:
- Import the
NumPy
library withnp
alias. - Apply the
.where()
method to thedf
dataframe. - Set the condition what values must remain unchanged. These must be non-dots values.
- Set the
other
parameter tonan
value fromNumPy
.
Все було зрозуміло?
You've solved the first problem with wrong column type. Let's solve the remaining one (with dots). Recall that there are 4 columns with wrong types left ('morgh', 'valueh', 'grosrth', 'omphtotinch'
). These columns considered to have dots as indicators for 'Not applicable'. For instance, columns valueh
and grosrth
are mutually exclusive, since the first one indicates the price of dwelling (i.e., house is owned) and the second one indicates the monthly rent.
The most appropriate way to solve this problem is to replace dots by NA
values. In that case, we would be able to manipulate column like a numerical one.
Завдання
Perform a replacement of dot symbols .
by NA
s for 'morgh', 'valueh', 'grosrth', 'omphtotinch'
columns. Follow the next steps:
- Import the
NumPy
library withnp
alias. - Apply the
.where()
method to thedf
dataframe. - Set the condition what values must remain unchanged. These must be non-dots values.
- Set the
other
parameter tonan
value fromNumPy
.