1. Learn
  2. /
  3. Courses
  4. /
  5. Intermediate Julia

Exercise

Advanced missing data

In the previous exercise, you saw how to identify how many missing values are in each column of a DataFrame, and then you can simply drop any rows that have missing values. However, what if there are a lot of rows with missing values? What if you don't simply want to start deleting rows from the data? This is where the concept of replacement comes in - you can replace the missing values with something else.

In this exercise, you will work with the same sales_df DataFrame as in the last exercise, but instead of dropping missing values, you will replace the missing values in each column with the average of all non-missing values. You will write a function that can then be applied to any column in a DataFrame.

Instructions 1/3

undefined XP
    1
    2
    3
  • Define a function called replace_missing() which takes one argument column_name.