如图所示,我需要统计每行中比指标值大的列的个数。。excel很容易用countif函数来计数。。
但是我用pandas死活搞不出结果来。。
我的代码是:
np.where(data[data.columns[1:]]> data['指标']).count(1) ---结果都是0
用:
(data[data.columns[1:]]> data['指标']).sum() ---结果也是0
求指点迷津
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
data ['countif'] = data.apply(lambda x : sum(data['X1:'X4'] > data['指标']),axis =1)