UNQ_C1: Expected outputs are correct but error found

Hi there,

After finishing my fraction_rows_missing function and running the test function fraction_rows_missing_test(fraction_rows_missing, X_train, X_val, X_test), I get:

Example dataframe:

     a    b
0  NaN  1.0
1  1.0  NaN
2  1.0  0.0
3  NaN  1.0 

Computed fraction missing:  0.75
Fraction of rows missing from X_train:  0.6986594132504371
Fraction of rows missing from X_val:  0.703962703962704
Fraction of rows missing from X_test:  0.0
Error: Wrong shape.
2  Tests passed
1  Tests failed
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-42-24c90d4f93a5> in <module>
     1 ### test cell ex1 - do not modify this test cell
----> 2 fraction_rows_missing_test(fraction_rows_missing, X_train, X_val, X_test)

~/work/W2A1/public_tests.py in fraction_rows_missing_test(target, X_train, X_val, X_test)
    40     ]
    41 
---> 42     multiple_test(test_cases, target)

~/work/W2A1/test_utils.py in multiple_test(test_cases, target)
   121         print('\033[92m', success," Tests passed")
   122         print('\033[91m', len(test_cases) - success, " Tests failed")
--> 123         raise AssertionError("Not all tests were passed for {}. Check your equations and avoid using global variables inside the function.".format(target.__name__))

AssertionError: Not all tests were passed for fraction_rows_missing. Check your equations and avoid using global variables inside the function.

The outputs are all correct but I get wrong shape. However, the output is a fraction so not sure what the problem is.

My function is

sorry, forgot is not allowed to post code.

My ID is tmfnvtfx

Any ideas what is the problem?

Hi @edgarbc,

Do you need help with this still ?

Best,
Mubsi

HI @Mubsi ,

No, I fixed this problem. Thanks for asking!

1 Like

Hello,

I am getting the same error message. The output looks ok but am getting the following message. Can you please help with this.

Thanks,
Sougato

Error message:

Example dataframe:

  a    b

0 NaN 1.0
1 1.0 NaN
2 1.0 0.0
3 NaN 1.0

Computed fraction missing: 0.75
Fraction of rows missing from X_train: 0.6986594132504371
Fraction of rows missing from X_val: 0.703962703962704
Fraction of rows missing from X_test: 0.0
Error: Wrong shape.
2 Tests passed
1 Tests failed