Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Managing an Incorrect Column | Preprocessing Data
Advanced Techniques in pandas
course content

Зміст курсу

Advanced Techniques in pandas

Advanced Techniques in pandas

1. Getting Familiar With Indexing and Selecting Data
2. Dealing With Conditions
3. Extracting Data
4. Aggregating Data
5. Preprocessing Data

Managing an Incorrect Column

So, you received the result object. This means that the type of the column is non-numerical, but to calculate necessary values, the column need to be numerical. Let's change that.

  1. Firstly, we need to replace - with .. To do so, you will apply the method .str.replace() to replace the character in the string in the dataset column. The syntax is
    data['column_name'].str.replace('old_symbol','new_symbol')
    In our case, old_symbol is -, and . is the new_symbol;
  2. Then, convert the column to the float data type. To do so, use .astype() method. The syntax is data['column_name'].astype('type').
    In our case, the type is 'float'.

Завдання

Your task is to:

  1. Follow the algorithm above and firstly replace - with . in the column 'Fare'.
  2. Convert the column 'Fare' to the 'float' data type.
  3. Output the type of the column 'Fare'.

Завдання

Your task is to:

  1. Follow the algorithm above and firstly replace - with . in the column 'Fare'.
  2. Convert the column 'Fare' to the 'float' data type.
  3. Output the type of the column 'Fare'.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

Секція 5. Розділ 8
toggle bottom row

Managing an Incorrect Column

So, you received the result object. This means that the type of the column is non-numerical, but to calculate necessary values, the column need to be numerical. Let's change that.

  1. Firstly, we need to replace - with .. To do so, you will apply the method .str.replace() to replace the character in the string in the dataset column. The syntax is
    data['column_name'].str.replace('old_symbol','new_symbol')
    In our case, old_symbol is -, and . is the new_symbol;
  2. Then, convert the column to the float data type. To do so, use .astype() method. The syntax is data['column_name'].astype('type').
    In our case, the type is 'float'.

Завдання

Your task is to:

  1. Follow the algorithm above and firstly replace - with . in the column 'Fare'.
  2. Convert the column 'Fare' to the 'float' data type.
  3. Output the type of the column 'Fare'.

Завдання

Your task is to:

  1. Follow the algorithm above and firstly replace - with . in the column 'Fare'.
  2. Convert the column 'Fare' to the 'float' data type.
  3. Output the type of the column 'Fare'.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

Секція 5. Розділ 8
toggle bottom row

Managing an Incorrect Column

So, you received the result object. This means that the type of the column is non-numerical, but to calculate necessary values, the column need to be numerical. Let's change that.

  1. Firstly, we need to replace - with .. To do so, you will apply the method .str.replace() to replace the character in the string in the dataset column. The syntax is
    data['column_name'].str.replace('old_symbol','new_symbol')
    In our case, old_symbol is -, and . is the new_symbol;
  2. Then, convert the column to the float data type. To do so, use .astype() method. The syntax is data['column_name'].astype('type').
    In our case, the type is 'float'.

Завдання

Your task is to:

  1. Follow the algorithm above and firstly replace - with . in the column 'Fare'.
  2. Convert the column 'Fare' to the 'float' data type.
  3. Output the type of the column 'Fare'.

Завдання

Your task is to:

  1. Follow the algorithm above and firstly replace - with . in the column 'Fare'.
  2. Convert the column 'Fare' to the 'float' data type.
  3. Output the type of the column 'Fare'.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

So, you received the result object. This means that the type of the column is non-numerical, but to calculate necessary values, the column need to be numerical. Let's change that.

  1. Firstly, we need to replace - with .. To do so, you will apply the method .str.replace() to replace the character in the string in the dataset column. The syntax is
    data['column_name'].str.replace('old_symbol','new_symbol')
    In our case, old_symbol is -, and . is the new_symbol;
  2. Then, convert the column to the float data type. To do so, use .astype() method. The syntax is data['column_name'].astype('type').
    In our case, the type is 'float'.

Завдання

Your task is to:

  1. Follow the algorithm above and firstly replace - with . in the column 'Fare'.
  2. Convert the column 'Fare' to the 'float' data type.
  3. Output the type of the column 'Fare'.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Секція 5. Розділ 8
Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
We're sorry to hear that something went wrong. What happened?
some-alt