LAB ID: gtizubcyvtpv
Gives a data-type mismatch even though it seems to go through the test data correcly.
Test Case 1:
Example df:
outcome TRTMT
0 0 0
1 1 1
2 1 1
3 1 1
Proportion of patient treated: 0.75
Test Case 2:
Example df:
outcome TRTMT
0 0 0
1 1 0
2 0 0
3 0 0
Proportion of patient treated: 0.0
Test Case 3:
Example df:
outcome TRTMT
0 0 0
1 1 1
2 1 0
3 1 0
Proportion of patient treated: 0.25
Error: Data-type mismatch.
4 Tests passed
1 Tests failed
1 Like
Hi @getjaidev and @gmaria,
Thank you for sharing the issue.
Can you check the data type of the return value according to the error message?
For example, you can check with type().
If the data type is float, can you wrap it with np.float64() and execute the code cell again?
In the docstring of the function proportion_treated(), the return value is stated as float, but when I checked the test function proportion_treated_test(), it seemed that the test case is prepared with np.float64() data type.
In addition, you can refer to the code of proportion_treated_test() in public_tests.py in the Lab files of your Coursera workspace.
Best regards,
Nakamura
1 Like
@nakamura
Thanks. Already done.
I think this should be included in the Hints because there is no way one would know what is the expected return type
1 Like
Hi @getjaidev,
Thank you for your advice.
I will feedback to the staffs.
Kinds regards,
Nakamura