I wanted to see if anyone else has run into this issue with this assignment. When I run my code through the test module it returns a single error stating: TypeError: unsupported operand types for list and list.
The reason it is returning this error is because it is trying to perform “assertAlmostEqual” on 2 lists which as far as I know can only be performed on integers/floats not lists of integers/floats.
Am I mistaken? How can I fix this?
This is the testing code:
def test_race_count(self):
actual = self.data[‘race_count’].tolist()
expected = [27816, 3124, 1039, 311, 271]
self.assertAlmostEqual(actual, expected, msg=“Expected race count values to be [27816, 3124, 1039, 311, 271]”)
This is my code that it is testing:
race_count = df.groupby(‘race’)[(‘race’)].count()
Your browser information: Google Chrome
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36
.
Challenge: Demographic Data Analyzer
Link to the challenge: