failing the C2_W2_Assignment grader.
i have used
def fraction_rows_missing(df):
‘’’
Return percent of rows with any missing
data in the dataframe.
Input:
df (dataframe): a pandas dataframe with potentially missing data
Output:
frac_missing (float): fraction of rows with missing data
'''
### START CODE HERE (REPLACE 'None' with your code) ###
### END CODE HERE ###
and i am getting :
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)
in
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.
xpected Output:
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
All tests passed.
i think that this is causing me to fail this task which is strange. can you please help.
Regards
Zvi