Python 计算收入数据时出错

Python 计算收入数据时出错,python,numpy,Python,Numpy,我一直在做一个项目,我必须根据一些数据来预测收入,现在我对我的收入进行了编码,因为它是一个使用这个代码的分类变量 Income_encod = LabelEncoder() Income = Income_encod.fit_transform(income_raw) 现在我有一些计算,包括 Income.count() 但我得到一个错误作为 “numpy.ndarray对象没有“count”属性” 不能使用方法count(),它是numpy数组上的列表方法。 如果您只想获得收入数组的长

我一直在做一个项目,我必须根据一些数据来预测收入,现在我对我的收入进行了编码,因为它是一个使用这个代码的分类变量

Income_encod = LabelEncoder() 
Income = Income_encod.fit_transform(income_raw) 
现在我有一些计算,包括

Income.count()
但我得到一个错误作为

“numpy.ndarray对象没有“count”属性”


不能使用方法
count()
,它是numpy数组上的列表方法。 如果您只想获得收入数组的长度,请尝试

Income.size


你试过len(收入)吗?是的,谢谢你,成功了
Income.shape
len(Income)