C3M5 Graded assignment excercise 4 and 6

    • The grader said excercise 4

      2. Date (from DatetimeIndex) of that largest absolute percent change

      Failed test case: max_pct_change_date has incorrect type. This should be a DatetimeIndex; make sure you are using the correct column.I have tried to make corrections, but it says df is not defined. I have used df, df_bur13 and df_bur13_chl in the first line of code

    • For exercise 6: Failed test case: predictors_simple has incorrect type. Failed test case: predictors_simple has incorrect type. Part of the code I wrote is predictors_simple=df_bur13_chl[[“idx”]]

Hi! If you’re still having issues with this lab, can you post the latest grader feedback (with the error messages) so the Mentors will know the latest status? Thanks.

Also, have you checked all the extra hints provided under these exercises? The ungraded labs can also help as reference. If you’re still stuck, just let us know here. Thanks.

As Chris said you should check out the extra hints,

The instructions don’t say it outright, but it wanted a plain list of column names (like [‘age’, ‘income’]), not a DataFrame.

Your predictors_simple and predictors_multi were DataFrames which is normally fine (sklearn loves them for X), but the checker was strict and only accepted a list.

Quick reason why list > DataFrame here: It is probably just asking for the feature names, not the data itself. Lists are super easy to check exactly (assert your_list == expected_list), while DataFrames have rows, index, etc. that can trip up equality checks.

Think of it like this:

  • df[[‘age’]] = handing over a mini spreadsheet with the “age” column (still 2D, full collection of values)
  • [‘age’] = just the label “age” on a sticky note

The grader wanted the sticky note, not the spreadsheet or even a 1-column DataFrame counts as “the whole collection,”

the checker fails because it’s looking for a simple list, not a pandas object. Even though later you might use that list to select columns, for example, X = dataframe[predictors], the variable itself has to be the list.

Why they do this:

  • The question is testing your understanding of which features/columns you’re choosing to use as predictors → so just the names (list of strings).
  • Auto-graders were finding exact matches on lists (easy to compare with == or set()).
  • DataFrames/Series carry extra stuff (shape, index, dtype, etc.) that makes strict checking harder or impossible without custom logic

Apologies for the late notice. Can you try to post your grader output again here? Are you still experiencing the issue?