pandas -数据框对象不可调用。(python 2) [英] Pandas - data frame object is not callable.(python 2)

查看:74
本文介绍了 pandas -数据框对象不可调用。(python 2)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码:

df(df.Sex=='male')

我收到一条错误消息,指出该数据帧对象不可调用。

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

我该如何解决?

推荐答案

它称为 布尔值索引 并需要 [] <仅/ code>:

It is called boolean indexing and need [] only:

df[df.Sex=='male']

或:

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

这篇关于 pandas -数据框对象不可调用。(python 2)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆