Home > Mobile >  'tuple' object is not callable for list of zip
'tuple' object is not callable for list of zip

Time:01-13

I am doing

list(zip(df['target'], df['smth']))

and get an error:

'tuple' object is not callable

The funny thing, that I am doing the exactly same thing in another notebook with the almost the same dataframe and it works. Also it worked here also, until sometime. I have no idea, what's wrong here

df['target'] is int64

df['smth']) is object

CodePudding user response:

Probably, in your notebook, you have defined a variable called list as a tuple.

For example, list = (1, 2)

When you call list(zip(df['target'], df['smth'])) it considers list as tuple, not a Python function. That is why you are getting this error.

Possible solutions

  • restart your kernel
  • delete your list variable del list
  • Related