I am currently experiencing the same error for both exercises 6 and 7. Even when I ran my code, it still has the same results as the expected results and yet the system deems it as wrong.
Hi. Welcome to the community. Could you please also share screenshots of the output for both exercises?
Did the outputs match the expected output exactly?
If yes, please click on my profile picture and share a copy of your lab notebook.
I might have been mistaken for exercise 6 since it has minor differences compared to its expected result. Exercise 7 however completely matched the expected results.
I am not taking this class so canāt run it myself to compare, but I do notice a clue in the error message. It says incorrect type, not incorrect value. This can happen if your code is expected to a return a list, and you returned a single object, or vice versa. Suggest take another look at your code with that in mind. Focus on return variable type and let us know.
Hello Jovaci, you might be using a different method in your solution. Please check the instructions and hints in the markdown. That usually tells you what type the variables should be.
Your code must be referencing to a different thing. The exercise should be related to idx?. Based on the hint and question, it should be a list. The original code, both start off with [None] represents a list, and your task is to replace None with your answer.
Hope this helps.
Hello! I like this suggestion from you. I was able to check and now I want to know what type should it really ask. Is it asking for a Series or a Dataframe? It isnāt really specified on the instructions nor hints. It also wouldnāt make much sense to me that my output still matches even if the type is not correct. I checked the type and both my predictors_simple and predictors_multi are both dataframes. Thank you
Hello, AflahZ! Your suggestion is very lovely. It did was asking for a list and I was able to solve the issue by making it into a list. Thank you very much! May I ask why does it prefer a list over a dataframe when both can be used either way? Thank you!
Based on @AflahZ ās helpful reply, you may know the answer to this already. But it has to do with whether you are looking at the level of a collection or at one of the collectionās members. Data frame is a 2D object, right? Rows with columns. The values of the columns of one row may be all correct, but if you give the grader the whole collection, even if it contains only a single row, it may be unhappy. Hope it helps.
Hello ai_curious! I fully understand it now thanks to your explanation. Thank you very much for you and AflahZās help! Hoping to learn more from this course! I didnāt think it about it like that and that sounds very cool when you put it like that.
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ās 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 love 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, as what ai_curious mentioned



