312-10 Issues Converting CSV into a list

Hi Team,
I am on mission 10 of Data science course link embedded here i have tried to convert the read csv into a list but i get an error on jupyter notebook while it runs on dataquest virtual development environment-can someone please help

Snippet from My Jupyter notebook

Snippet from Data Quest

Hey @samini099, welcome to the community.

The error you’re seeing is TypeError: 'str' object is not callable, and the error points to where you use list(readfile).

What this is telling you is that list has been made into a string, and that you can’t “call” (use with parenetheses like list()) a string.

At some point in your notebook you have likely done something like the below:

list = "this is a string I'm assigning to the variable name `list`"

This will overwrite the built-in list() function with your string. There are two ways you can resolve this issue. One is to use the del keyword to delete your list variable, which will leave the built-in function underneath for use again:

del list

If you’re working in Jupyter notebook and you no longer have the code that overwrote the list function, another option is to go to Kernel >> Restart and Run all which will reset your python kernel and run all cells, which deletes all the variables you previously created.

I hope this is helpful — if there is any part of this you don’t understand, please let me know :slight_smile:

3 Likes