Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'bool' object has no attribute 'sum' #53

Closed
zhaozhongfeng1990 opened this issue Jul 28, 2020 · 4 comments
Closed

'bool' object has no attribute 'sum' #53

zhaozhongfeng1990 opened this issue Jul 28, 2020 · 4 comments

Comments

@zhaozhongfeng1990
Copy link

c=(arr==value).sum

@Secbone
Copy link
Member

Secbone commented Jul 30, 2020

@zhaozhongfeng1990 any more details?

@zhangyanfirez
Copy link

我也遇到了这个问题:
\toad\utils\func.py in np_count(arr, value, default)
55
56 def np_count(arr, value, default = None):
---> 57 c = (arr == value).sum()
58
59 if default is not None and c == 0:

AttributeError: 'bool' object has no attribute 'sum'

@Secbone
Copy link
Member

Secbone commented Feb 1, 2021

@zhangyanfirez 有更多的报错信息么?调用哪个方法的时候报错的?怎么调用的?

@zhangyanfirez
Copy link

@Secbone 目前已经解决了。问题是使用了pyspark的toPandas()将pyspark的dataframe转换为pandas dataframe后调用了toad.selection.select时报错,原因是(arr == value).sum()中的arr要求是numpy array 。重新使用pandas读取数据后再调用toad.selection.select没有出现问题。

@Secbone Secbone closed this as completed Feb 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants