Hi,
under “Dictionaries and Frequency tables”/ “8. Finding the unique values”, I cannot run the pre-provided code; it returns the error: “TypeError: ‘list’ object is not callable”.
Screen Link: Learn data science with Python and R projects
My Code:
opened_file = open('AppleStore.csv')
from csv import reader
read_file = reader(opened_file)
apps_data = list(read_file)
content_ratings = {}
for list in apps_data[1:]:
c_rating = list[10]
if c_rating not in content_ratings:
content_ratings[c_rating] = 1
else:
content_ratings[c_rating] += 1
print(content_ratings)
What actually happened:
TypeErrorTraceback (most recent call last)
<ipython-input-1-b1fe082a28c9> in <module>()
2 from csv import reader
3 read_file = reader(opened_file)
----> 4 apps_data = list(read_file)
5
6 content_ratings = {}
TypeError: 'list' object is not callable
Other details:
I am not sure what I have done wrong… although on the previous slide “7. Counting with dictionaries”, I actually submitted the answer for “8. Finding the unique values”. As I had learnt the technique already, I applied it one slide earlier in 7. Perhaps this is what is causing the problem? I haven’t been unable to undo the error.
Wondering if you could please advise how to proceed?