- sample = {
- 'a': np.random.randn(10).round(2),
- 'b': np.random.randint(1,10,10),
- 'c': np.random.randint(-2,10,10),
- }
- df = pd.DataFrame(sample)
- df
- #%%
- df['count'] = df.apply(lambda x: len([s for s in x if s> 0]), axis = 1)
- df
|
楼主: xlbdh2
|
1494
10
统计每行>3的数值出现次数 |
加好友,备注cda京ICP备16021002号-2 京B2-20170662号
京公网安备 11010802022788号
论坛法律顾问:王进律师
知识产权保护声明
免责及隐私声明


