Pandas - data frame object is not callable.(python 2)

前端 未结 1 800
逝去的感伤
逝去的感伤 2021-01-16 17:48

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 t

1条回答
  •  北恋
    北恋 (楼主)
    2021-01-16 18:27

    It is called boolean indexing and need [] only:

    df[df.Sex=='male']
    

    Or:

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

    0 讨论(0)
提交回复
热议问题