I am getting the following error:
ERROR: test_average_age_men (test_module.DemographicAnalyzerTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/runner/EnlightenedWhirlwindMemorypool/test_module.py", line
16, in test_average_age_men
self.assertAlmostEqual(actual, expected, "Expected different value fo
r average age of men.")
File "/usr/lib/python3.8/unittest/case.py", line 957, in assertAlmostEq
ual
if round(diff, places) == 0:
TypeError: an integer is required (got type str)
I am getting this error for 5 test cases out of 10.
The code that I am using is:
average_age_men = df.loc[df['sex']=='Male', 'age'].mean()
I checked the type of the variable and it is numpy.float64
.
Please help me with this.