Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python/Pandas TypeError: 'list' object is not callable

This is not a duplicate question, or at least I don't think so.

When I try to run this code snippet of just two lines:

import pandas as pd

mydates = pd.date_range('2010-01-22', '2010-01-26')

On trying the foll:

In [16]:import pandas as pd

In [17]:mydates = pd.date_range('2010-01-22', '2010-01-26')
Traceback (most recent call last):

I get the below error after trying on both 2.7 and 3.6

File "<ipython-input-17-ef49b611e028>", line 1, in <module>
        mydates = pd.date_range('2010-01-22', '2010-01-26')

    TypeError: 'list' object is not callable

What am I doing wrong?

like image 222
MadHatter Avatar asked Dec 19 '22 07:12

MadHatter


1 Answers

Looks like python thinks pd.date_range is a list and that you're trying to call it. You may have accidentally done something like this:

pd.date_range = []

Check to see what its type is

type(pd.date_range)

list

solution

Restart your kernel.

like image 84
piRSquared Avatar answered Dec 21 '22 10:12

piRSquared