Faraz Gerrard Jamal
Faraz Gerrard Jamal

Reputation: 248

Pandas - DataFrame object is not callable

I have the following code:

df(df.Sex=='male')

I get an error stating that the DataFrame object is not callable.

How can I solve this?

Upvotes: 0

Views: 24899

Answers (1)

jezrael
jezrael

Reputation: 862431

It is called boolean indexing and need [] only:

df[df.Sex=='male']

Or:

df.query("Sex =='male'")

Upvotes: 13

Related Questions