san
san

Reputation: 333

How to resolve the error 'tuple' object is not callable

I am new to python, I have imported a file into jupyter as follows:

df = pd.read_csv(r"C:\Users\shalotte1\Documents\EBQS_INTEGRATEDQUOTEDOCUMENT\groceries.csv")

I am using the following code to determine the number of rows and columns in the data

df.shape()

However I am getting the following error:

TypeError: 'tuple' object is not callable

Upvotes: 2

Views: 5976

Answers (2)

Alvis矜
Alvis矜

Reputation: 133

As you are new to python, I would recommend you to read this page. This will make you get aware of other causes too so that you can solve this problem again if it appears in the future.

https://careerkarma.com/blog/python-typeerror-tuple-object-is-not-callable/

Upvotes: 0

kabdulla
kabdulla

Reputation: 5429

You want df.shape - this will return a tuple as in (n_rows, n_cols). You are then trying to call this tuple as though it were a function.

Upvotes: 8

Related Questions