Module 4 Assignment: Analyzing Car CO₂ Emissions ex1 and 2

these code is not working. can someone help me debug it corretly

from scipy.stats import ttest_ind

{moderator edit: solution code removed}

I modified your post so that the code is shown inside the “Code” tags. That makes it more readable.

But I suspect you’re not really supposed to post your code for this course - the Code of Conduct doesn’t allow that.

What is the error you are getting? Kindly post the error too. Next time post the errors you get and not the graded code. The graded code is not to be publicly posted, according to the community guidelines.

Regarding exercise 1, the problem is that you did not follow this instruction:

  1. Create a new dataframe compact by filtering the original dataframe to contain only the compact cars.

  2. Create a new dataframe mid_size by filtering the original dataframe to contain only the mid-size cars. (Note: for grading purposes, this and the dataframe above should have all the features and not just the CO2 emissions feature)

Your answer should be all the columns, not just the CO2 emissions column. I think it should work if you do that.
Also, not sure how your extra import could affect the grader. scipy.stats was imported as stats already at the top of the notebook. So, you should use stats.ttest_ind instead of importing ttest_ind again.
Your exercise 2 solution looks correct. Please post the error or the output so we can check.
I have removed the code since it violates community guidelines.

1 Like